aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google/devtools/build/skyframe/ErrorInfoTest.java
diff options
context:
space:
mode:
authorGravatar Nathan Harmata <nharmata@google.com>2015-12-09 23:36:22 +0000
committerGravatar Lukacs Berki <lberki@google.com>2015-12-10 12:39:01 +0000
commit977316812543c64725beefc4d1f1c74cb1a870c0 (patch)
tree726a885b197c7c275bf00eae139dee6af6716feb /src/test/java/com/google/devtools/build/skyframe/ErrorInfoTest.java
parent75ba9b938716a857a601f920bde87e5ee4413645 (diff)
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
Diffstat (limited to 'src/test/java/com/google/devtools/build/skyframe/ErrorInfoTest.java')
-rw-r--r--src/test/java/com/google/devtools/build/skyframe/ErrorInfoTest.java40
1 files changed, 31 insertions, 9 deletions
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 2a5db2d2be..3e15000594 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 @@ public class ErrorInfoTest {
}
}
- @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 @@ public class ErrorInfoTest {
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 @@ public class ErrorInfoTest {
new CycleInfo(
ImmutableList.of(currentKey, Iterables.getOnlyElement(cycle.getPathToCycle())),
cycle.getCycle()));
- assertThat(errorInfo.isTransient()).isFalse();
+ assertThat(errorInfo.isTransient()).isTrue();
assertThat(errorInfo.isCatastrophic()).isTrue();
}