Deflake ParallelEvaluatorTest.errorBubblesToParentsOfTopLevelValue: error cannot finish building until top registers a dep on it, and we can only know that by listening to the addReverseDep call.
@@ -773,14 +773,23 @@ public class ParallelEvaluatorTest {
@Test
public void errorBubblesToParentsOfTopLevelValue() throws Exception {
- graph = new InMemoryGraphImpl();
SkyKey parentKey = GraphTester.toSkyKey("parent");
- final SkyKey errorKey = GraphTester.toSkyKey("error");
- final CountDownLatch latch = new CountDownLatch(1);
+ SkyKey errorKey = GraphTester.toSkyKey("error");
+ CountDownLatch latch = new CountDownLatch(1);
+ graph =
+ new NotifyingHelper.NotifyingProcessableGraph(
+ new InMemoryGraphImpl(),
+ (key, type, order, context) -> {
+ if (key.equals(errorKey)
+ && parentKey.equals(context)
+ && type == EventType.ADD_REVERSE_DEP
+ && order == Order.AFTER) {
+ latch.countDown();
+ }
+ });
tester.getOrCreate(errorKey).setBuilder(new ChainedFunction(null, /*waitToFinish=*/latch, null,
false, /*value=*/null, ImmutableList.<SkyKey>of()));
- tester.getOrCreate(parentKey).setBuilder(new ChainedFunction(/*notifyStart=*/latch, null, null,
- false, new StringValue("unused"), ImmutableList.of(errorKey)));
+ tester.getOrCreate(parentKey).addDependency(errorKey).setComputedValue(CONCATENATE);
EvaluationResult<StringValue> result = eval( /*keepGoing=*/false,
ImmutableList.of(parentKey, errorKey));
assertWithMessage(result.toString()).that(result.errorMap().size()).isEqualTo(2);
