Skip to content

Commit

Permalink
Switch to helper.
Browse files Browse the repository at this point in the history
  • Loading branch information
cmeiklejohn committed Jul 5, 2023
1 parent 7344ad5 commit 65453c4
Showing 1 changed file with 1 addition and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,41 +95,7 @@ default void execute() {
shouldRunAssertionBlock = false;
}
} else {
// Single fault.
//
// See if we have special error handling for this fault, then bypass the existing assertion block
// in favor of the fault-specific assertion block.
//
if (argsKey != null && modifiedAssertionsByRequest.containsKey(methodKey + argsKey)) {
try {
modifiedAssertionsByRequest.get(methodKey + argsKey).run();
} catch (Throwable t) {
throw new FilibusterGrpcTestRuntimeException(
"Assertions in onFaultOnRequest(" + methodKey + ", ReqT, Runnable) failed.",
"Please adjust assertions in onFaultOnRequest(" + methodKey + ", " + argsKey.replaceAll("\\n", "") + ", Runnable) so that test passes.",
t);
}

shouldRunAssertionBlock = false;
} else if (modifiedAssertionsByMethod.containsKey(methodKey)) {
try {
modifiedAssertionsByMethod.get(methodKey).run();
} catch (Throwable t) {
throw new FilibusterGrpcTestRuntimeException(
"Assertions in onFaultOnMethod(" + methodKey + ", Runnable) failed.",
"Please adjust assertions in onFaultOnMethod(" + methodKey + ", Runnable) so that test passes.",
t);
}
shouldRunAssertionBlock = false;
} else {
if (!methodsWithNoFaultImpact.contains(methodKey)) {
throw new FilibusterGrpcTestRuntimeException(
"Test injected a fault, but no specification of failure behavior present.",
"Please use onFaultOnMethod(MethodDescriptor, Runnable), onFaultOnRequest(MethodDescriptor, ReqT, Runnable), or onFaultOnMethodHasNoEffect(MethodDescriptor) to specify assertions under fault.");
}

// Otherwise, pass through and run normal assertion blcok.
}
shouldRunAssertionBlock = performSingleFaultChecking(methodKey, argsKey);
}
}

Expand Down

0 comments on commit 65453c4

Please sign in to comment.