Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix timeout error message #525

Merged
merged 1 commit into from
Dec 2, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import com.google.daq.mqtt.util.ConfigUtil;
import com.google.daq.mqtt.validator.AugmentedState;
import com.google.daq.mqtt.validator.AugmentedSystemConfig;
import com.google.daq.mqtt.validator.Validator;
import com.google.daq.mqtt.validator.Validator.MessageBundle;
import com.google.udmi.util.CleanDateFormat;
import com.google.udmi.util.JsonUtil;
Expand Down Expand Up @@ -110,6 +109,7 @@ public abstract class SequenceBase {
private static final String SEQUENCE_MD = "sequence.md";
private static final String CONFIG_NONCE_KEY = "debug_config_nonce";
private static final long CLEAN_START_DELAY_MS = 20 * 1000;
private static final String WAITING_FOR_GODOT = "nothing";
protected static Metadata deviceMetadata;
protected static String projectId;
protected static String deviceId;
Expand Down Expand Up @@ -211,7 +211,8 @@ protected void failed(Throwable e, org.junit.runner.Description description) {
final String type;
final Level level;
if (e instanceof TestTimedOutException) {
message = "timeout " + waitingCondition;
message = waitingCondition.equals(WAITING_FOR_GODOT) ? "test timeout exceeded"
: "timeout " + waitingCondition;
type = RESULT_FAIL;
level = Level.ERROR;
} else if (e instanceof SkipTest) {
Expand Down Expand Up @@ -459,9 +460,10 @@ public void valid_serial_no() {
}

private void recordResult(String result, String methodName, String message) {
notice(String.format(RESULT_FORMAT, result, methodName, message));
String resultString = String.format(RESULT_FORMAT, result, methodName, message);
notice(resultString);
try (PrintWriter log = new PrintWriter(new FileOutputStream(resultSummary, true))) {
log.printf(RESULT_FORMAT, result, methodName, message);
log.print(resultString);
} catch (Exception e) {
throw new RuntimeException("While writing report summary " + resultSummary.getAbsolutePath(),
e);
Expand Down Expand Up @@ -603,7 +605,10 @@ public void tearDown() {
if (debugLogLevel()) {
warning("Not resetting config to enable post-execution debugging");
} else {
// Save the current waiting condition which will include the relevant info for reporting.
String savedCondition = waitingCondition;
resetConfig();
waitingCondition = savedCondition;
}
deviceConfig = null;
deviceState = null;
Expand Down Expand Up @@ -784,7 +789,7 @@ private void untilLoop(Supplier<Boolean> evaluator, String description) {
processMessage();
}
info(String.format("finished %s after %s", waitingCondition, timeSinceStart()));
waitingCondition = "nothing";
waitingCondition = WAITING_FOR_GODOT;
}

private void recordSequence(String step) {
Expand Down