@@ -513,4 +513,53 @@ public void remoteCacheEvictBlobs_incrementalBuildCanContinue() throws Exception
513
513
// Assert: target was successfully built
514
514
assertValidOutputFile ("a/bar.out" , "foo" + lineSeparator () + "updated bar" + lineSeparator ());
515
515
}
516
+
517
+ @ Test
518
+ public void remoteCacheEvictBlobs_treeArtifact_incrementalBuildCanContinue () throws Exception {
519
+ // Arrange: Prepare workspace and populate remote cache
520
+ write ("BUILD" );
521
+ writeOutputDirRule ();
522
+ write (
523
+ "a/BUILD" ,
524
+ "load('//:output_dir.bzl', 'output_dir')" ,
525
+ "output_dir(" ,
526
+ " name = 'foo.out'," ,
527
+ " manifest = ':manifest'," ,
528
+ ")" ,
529
+ "genrule(" ,
530
+ " name = 'bar'," ,
531
+ " srcs = ['foo.out', 'bar.in']," ,
532
+ " outs = ['bar.out']," ,
533
+ " cmd = '( ls $(location :foo.out); cat $(location :bar.in) ) > $@'," ,
534
+ " tags = ['no-remote-exec']," ,
535
+ ")" );
536
+ write ("a/manifest" , "file-inside" );
537
+ write ("a/bar.in" , "bar" );
538
+
539
+ // Populate remote cache
540
+ buildTarget ("//a:bar" );
541
+ getOutputPath ("a/foo.out" ).deleteTreesBelow ();
542
+ getOutputPath ("a/bar.out" ).delete ();
543
+ getOutputBase ().getRelative ("action_cache" ).deleteTreesBelow ();
544
+ restartServer ();
545
+
546
+ // Clean build, foo.out isn't downloaded
547
+ buildTarget ("//a:bar" );
548
+ assertOutputDoesNotExist ("a/foo.out/file-inside" );
549
+
550
+ // Evict blobs from remote cache
551
+ worker .restart ();
552
+
553
+ // trigger build error
554
+ write ("a/bar.in" , "updated bar" );
555
+ // Build failed because of remote cache eviction
556
+ assertThrows (BuildFailedException .class , () -> buildTarget ("//a:bar" ));
557
+
558
+ // Act: Do an incremental build without "clean" or "shutdown"
559
+ buildTarget ("//a:bar" );
560
+
561
+ // Assert: target was successfully built
562
+ assertValidOutputFile (
563
+ "a/bar.out" , "file-inside" + lineSeparator () + "updated bar" + lineSeparator ());
564
+ }
516
565
}
0 commit comments