37
37
import com .google .devtools .build .lib .actions .Artifact .TreeFileArtifact ;
38
38
import com .google .devtools .build .lib .actions .ArtifactRoot ;
39
39
import com .google .devtools .build .lib .actions .ArtifactRoot .RootType ;
40
+ import com .google .devtools .build .lib .actions .ExecException ;
40
41
import com .google .devtools .build .lib .actions .FileArtifactValue ;
41
42
import com .google .devtools .build .lib .actions .FileArtifactValue .RemoteFileArtifactValue ;
42
43
import com .google .devtools .build .lib .actions .MetadataProvider ;
43
44
import com .google .devtools .build .lib .actions .util .ActionsTestUtil ;
44
45
import com .google .devtools .build .lib .clock .JavaClock ;
45
- import com .google .devtools .build .lib .remote .common .BulkTransferException ;
46
46
import com .google .devtools .build .lib .remote .util .StaticMetadataProvider ;
47
47
import com .google .devtools .build .lib .remote .util .TempPathGenerator ;
48
48
import com .google .devtools .build .lib .skyframe .TreeArtifactValue ;
@@ -160,7 +160,8 @@ protected Pair<SpecialArtifact, ImmutableList<TreeFileArtifact>> createRemoteTre
160
160
protected abstract AbstractActionInputPrefetcher createPrefetcher (Map <HashCode , byte []> cas );
161
161
162
162
@ Test
163
- public void prefetchFiles_fileExists_doNotDownload () throws IOException , InterruptedException {
163
+ public void prefetchFiles_fileExists_doNotDownload ()
164
+ throws IOException , ExecException , InterruptedException {
164
165
Map <ActionInput , FileArtifactValue > metadata = new HashMap <>();
165
166
Map <HashCode , byte []> cas = new HashMap <>();
166
167
Artifact a = createRemoteArtifact ("file" , "hello world" , metadata , cas );
@@ -177,7 +178,7 @@ public void prefetchFiles_fileExists_doNotDownload() throws IOException, Interru
177
178
178
179
@ Test
179
180
public void prefetchFiles_fileExistsButContentMismatches_download ()
180
- throws IOException , InterruptedException {
181
+ throws IOException , ExecException , InterruptedException {
181
182
Map <ActionInput , FileArtifactValue > metadata = new HashMap <>();
182
183
Map <HashCode , byte []> cas = new HashMap <>();
183
184
Artifact a = createRemoteArtifact ("file" , "hello world remote" , metadata , cas );
@@ -304,7 +305,7 @@ public void prefetchFiles_missingFiles_fails() throws Exception {
304
305
AbstractActionInputPrefetcher prefetcher = createPrefetcher (new HashMap <>());
305
306
306
307
assertThrows (
307
- BulkTransferException .class ,
308
+ Exception .class ,
308
309
() -> wait (prefetcher .prefetchFiles (ImmutableList .of (a ), metadataProvider )));
309
310
310
311
assertThat (prefetcher .downloadedFiles ()).isEmpty ();
@@ -347,7 +348,7 @@ public void prefetchFiles_multipleThreads_downloadIsCancelled() throws Exception
347
348
() -> {
348
349
try {
349
350
wait (prefetcher .prefetchFiles (ImmutableList .of (artifact ), metadataProvider ));
350
- } catch (IOException | InterruptedException ignored ) {
351
+ } catch (IOException | ExecException | InterruptedException ignored ) {
351
352
// do nothing
352
353
}
353
354
});
@@ -357,7 +358,7 @@ public void prefetchFiles_multipleThreads_downloadIsCancelled() throws Exception
357
358
() -> {
358
359
try {
359
360
wait (prefetcher .prefetchFiles (ImmutableList .of (artifact ), metadataProvider ));
360
- } catch (IOException | InterruptedException ignored ) {
361
+ } catch (IOException | ExecException | InterruptedException ignored ) {
361
362
// do nothing
362
363
}
363
364
});
@@ -394,7 +395,7 @@ public void prefetchFiles_multipleThreads_downloadIsNotCancelledByOtherThreads()
394
395
() -> {
395
396
try {
396
397
wait (prefetcher .prefetchFiles (ImmutableList .of (artifact ), metadataProvider ));
397
- } catch (IOException | InterruptedException ignored ) {
398
+ } catch (IOException | ExecException | InterruptedException ignored ) {
398
399
// do nothing
399
400
}
400
401
});
@@ -406,7 +407,7 @@ public void prefetchFiles_multipleThreads_downloadIsNotCancelledByOtherThreads()
406
407
try {
407
408
wait (prefetcher .prefetchFiles (ImmutableList .of (artifact ), metadataProvider ));
408
409
successful .set (true );
409
- } catch (IOException | InterruptedException ignored ) {
410
+ } catch (IOException | ExecException | InterruptedException ignored ) {
410
411
// do nothing
411
412
}
412
413
});
@@ -489,13 +490,14 @@ public void downloadFile_onInterrupt_deletePartialDownloadedFile() throws Except
489
490
}
490
491
491
492
protected static void wait (ListenableFuture <Void > future )
492
- throws IOException , InterruptedException {
493
+ throws IOException , ExecException , InterruptedException {
493
494
try {
494
495
future .get ();
495
496
} catch (ExecutionException e ) {
496
497
Throwable cause = e .getCause ();
497
498
if (cause != null ) {
498
499
throwIfInstanceOf (cause , IOException .class );
500
+ throwIfInstanceOf (cause , ExecException .class );
499
501
throwIfInstanceOf (cause , InterruptedException .class );
500
502
throwIfInstanceOf (cause , RuntimeException .class );
501
503
}
0 commit comments