use of com.google.devtools.build.lib.actions.ActionStartedEvent in project bazel by bazelbuild.
the class ExperimentalStateTrackerTest method testCompletedActionNotShown.
@Test
public void testCompletedActionNotShown() throws IOException {
// Completed actions should not be reported in the progress bar, nor in the
// short progress bar.
String messageFast = "Running quick action";
String messageSlow = "Running slow action";
ManualClock clock = new ManualClock();
clock.advanceMillis(120000);
Action fastAction = mockAction(messageFast, "foo/fast");
Action slowAction = mockAction(messageSlow, "bar/slow");
ExperimentalStateTracker stateTracker = new ExperimentalStateTracker(clock);
stateTracker.actionStarted(new ActionStartedEvent(fastAction, 123456789));
stateTracker.actionStarted(new ActionStartedEvent(slowAction, 123456999));
stateTracker.actionCompletion(new ActionCompletionEvent(20, fastAction));
LoggingTerminalWriter terminalWriter = new LoggingTerminalWriter(/*discardHighlight=*/
true);
stateTracker.writeProgressBar(terminalWriter);
String output = terminalWriter.getTranscript();
assertFalse("Completed action '" + messageFast + "' should not be present in output: " + output, output.contains(messageFast));
assertTrue("Only running action '" + messageSlow + "' should be present in output: " + output, output.contains(messageSlow));
terminalWriter = new LoggingTerminalWriter();
stateTracker.writeProgressBar(terminalWriter, /* shortVersion=*/
true);
output = terminalWriter.getTranscript();
assertFalse("Completed action '" + messageFast + "' should not be present in short output: " + output, output.contains(messageFast));
assertTrue("Only running action '" + messageSlow + "' should be present in short output: " + output, output.contains(messageSlow));
}
Aggregations