Repurpose the not-meaningfully-used ErrorInfo#isTransient to mean "is transitively transient". Some followup changes will use this method.
Previously, ErrorInfo#isTransient was only used internally in ParallelEvaluator; I think this method was originally added to ErrorInfo solely for the sake of convenience.
--
MOS_MIGRATED_REVID=109840031
diff --git a/src/test/java/com/google/devtools/build/skyframe/ErrorInfoTest.java b/src/test/java/com/google/devtools/build/skyframe/ErrorInfoTest.java
index 2a5db2d..3e15000 100644
--- a/src/test/java/com/google/devtools/build/skyframe/ErrorInfoTest.java
+++ b/src/test/java/com/google/devtools/build/skyframe/ErrorInfoTest.java
@@ -47,25 +47,45 @@
}
}
- @Test
- public void testFromException() {
+ private void runTestFromException(boolean isDirectlyTransient, boolean isTransitivelyTransient) {
Exception exception = new IOException("ehhhhh");
SkyKey causeOfException = new SkyKey(SkyFunctionName.create("CAUSE"), 1234);
DummySkyFunctionException dummyException =
- new DummySkyFunctionException(exception, /*isTransient=*/ true, /*isCatastrophic=*/ false);
+ new DummySkyFunctionException(exception, isDirectlyTransient, /*isCatastrophic=*/ false);
ErrorInfo errorInfo = ErrorInfo.fromException(
- new ReifiedSkyFunctionException(dummyException, causeOfException));
+ new ReifiedSkyFunctionException(dummyException, causeOfException),
+ isTransitivelyTransient);
assertThat(errorInfo.getRootCauses()).containsExactly(causeOfException);
assertThat(errorInfo.getException()).isSameAs(exception);
assertThat(errorInfo.getRootCauseOfException()).isSameAs(causeOfException);
assertThat(errorInfo.getCycleInfo()).isEmpty();
- assertThat(errorInfo.isTransient()).isTrue();
+ assertThat(errorInfo.isTransient()).isEqualTo(isDirectlyTransient || isTransitivelyTransient);
assertThat(errorInfo.isCatastrophic()).isFalse();
}
@Test
+ public void testFromException_NonTransient() {
+ runTestFromException(/*isDirectlyTransient=*/ false, /*isTransitivelyTransient= */ false);
+ }
+
+ @Test
+ public void testFromException_DirectlyTransient() {
+ runTestFromException(/*isDirectlyTransient=*/ true, /*isTransitivelyTransient= */ false);
+ }
+
+ @Test
+ public void testFromException_TransitivelyTransient() {
+ runTestFromException(/*isDirectlyTransient=*/ false, /*isTransitivelyTransient= */ true);
+ }
+
+ @Test
+ public void testFromException_DirectlyAndTransitivelyTransient() {
+ runTestFromException(/*isDirectlyTransient=*/ true, /*isTransitivelyTransient= */ true);
+ }
+
+ @Test
public void testFromCycle() {
CycleInfo cycle = new CycleInfo(
ImmutableList.of(new SkyKey(SkyFunctionName.create("PATH"), 1234)),
@@ -92,15 +112,17 @@
DummySkyFunctionException dummyException1 =
new DummySkyFunctionException(exception1, /*isTransient=*/ true, /*isCatastrophic=*/ false);
ErrorInfo exceptionErrorInfo1 = ErrorInfo.fromException(
- new ReifiedSkyFunctionException(dummyException1, causeOfException1));
+ new ReifiedSkyFunctionException(dummyException1, causeOfException1),
+ /*isTransitivelyTransient=*/ false);
// N.B this ErrorInfo will be catastrophic.
Exception exception2 = new IOException("blahhhhh");
SkyKey causeOfException2 = new SkyKey(SkyFunctionName.create("CAUSE2"), 5678);
DummySkyFunctionException dummyException2 =
- new DummySkyFunctionException(exception2, /*isTransient=*/ true, /*isCatastrophic=*/ true);
+ new DummySkyFunctionException(exception2, /*isTransient=*/ false, /*isCatastrophic=*/ true);
ErrorInfo exceptionErrorInfo2 = ErrorInfo.fromException(
- new ReifiedSkyFunctionException(dummyException2, causeOfException2));
+ new ReifiedSkyFunctionException(dummyException2, causeOfException2),
+ /*isTransitivelyTransient=*/ false);
SkyKey currentKey = new SkyKey(SkyFunctionName.create("CURRENT"), 9876);
@@ -119,7 +141,7 @@
new CycleInfo(
ImmutableList.of(currentKey, Iterables.getOnlyElement(cycle.getPathToCycle())),
cycle.getCycle()));
- assertThat(errorInfo.isTransient()).isFalse();
+ assertThat(errorInfo.isTransient()).isTrue();
assertThat(errorInfo.isCatastrophic()).isTrue();
}