@@ -1174,6 +1174,7 @@ public void testAggregation() throws Exception {
11741174 ManualClock clock = new ManualClock ();
11751175 clock .advanceMillis (TimeUnit .SECONDS .toMillis (1234 ));
11761176 UiStateTracker stateTracker = getUiStateTracker (clock , /*targetWidth=*/ 80 );
1177+ stateTracker .setProgressSampleSize (4 );
11771178 // Mimic being at the execution phase.
11781179 simulateExecutionPhase (stateTracker );
11791180
@@ -1185,7 +1186,7 @@ public void testAggregation() throws Exception {
11851186 labelFooTest ,
11861187 ImmutableList .of (),
11871188 new Location ("dummy-file" , 0 , 0 ),
1188- "dummy-mnemonic " ,
1189+ "TestRunner " ,
11891190 "dummy-target-kind" ,
11901191 "abcdef" ,
11911192 new BuildConfigurationEvent (
@@ -1198,15 +1199,12 @@ public void testAggregation() throws Exception {
11981199 Label labelBarTest = Label .parseCanonical ("//baz:bartest" );
11991200 ConfiguredTarget targetBarTest = mock (ConfiguredTarget .class );
12001201 when (targetBarTest .getLabel ()).thenReturn (labelBarTest );
1201- TestFilteringCompleteEvent filteringComplete = mock (TestFilteringCompleteEvent .class );
1202- when (filteringComplete .getTestTargets ())
1203- .thenReturn (ImmutableSet .of (targetFooTest , targetBarTest ));
12041202 ActionOwner barOwner =
12051203 ActionOwner .create (
12061204 labelBarTest ,
12071205 ImmutableList .of (),
12081206 new Location ("dummy-file" , 0 , 0 ),
1209- "dummy-mnemonic " ,
1207+ "TestRunner " ,
12101208 "dummy-target-kind" ,
12111209 "fedcba" ,
12121210 new BuildConfigurationEvent (
@@ -1216,6 +1214,27 @@ public void testAggregation() throws Exception {
12161214 ImmutableMap .of (),
12171215 null );
12181216
1217+ Label labelBazTest = Label .parseCanonical ("//baz:baztest" );
1218+ ConfiguredTarget targetBazTest = mock (ConfiguredTarget .class );
1219+ when (targetBazTest .getLabel ()).thenReturn (labelBazTest );
1220+ ActionOwner bazOwner =
1221+ ActionOwner .create (
1222+ labelBazTest ,
1223+ ImmutableList .of (),
1224+ new Location ("dummy-file" , 0 , 0 ),
1225+ "NonTestAction" ,
1226+ "dummy-target-kind" ,
1227+ "fedcba" ,
1228+ new BuildConfigurationEvent (
1229+ BuildEventStreamProtos .BuildEventId .getDefaultInstance (),
1230+ BuildEventStreamProtos .BuildEvent .getDefaultInstance ()),
1231+ null ,
1232+ ImmutableMap .of (),
1233+ null );
1234+
1235+ TestFilteringCompleteEvent filteringComplete = mock (TestFilteringCompleteEvent .class );
1236+ when (filteringComplete .getTestTargets ())
1237+ .thenReturn (ImmutableSet .of (targetFooTest , targetBarTest , targetBazTest ));
12191238 stateTracker .testFilteringComplete (filteringComplete );
12201239
12211240 // First produce 10 actions for footest...
@@ -1232,10 +1251,17 @@ public void testAggregation() throws Exception {
12321251 when (action .getOwner ()).thenReturn (barOwner );
12331252 stateTracker .actionStarted (new ActionStartedEvent (action , clock .nanoTime ()));
12341253 }
1235- // ...and finally a completely unrelated action
1254+ // ...run a completely unrelated action..
12361255 clock .advanceMillis (TimeUnit .SECONDS .toMillis (1 ));
12371256 stateTracker .actionStarted (
12381257 new ActionStartedEvent (mockAction ("Other action" , "other/action" ), clock .nanoTime ()));
1258+ // ...and finally, run actions that are associated with baztest but are not a test.
1259+ for (int i = 0 ; i < 10 ; i ++) {
1260+ clock .advanceMillis (1_000 );
1261+ Action action = mockAction ("Doing something " + i , "someartifact_" + i );
1262+ when (action .getOwner ()).thenReturn (bazOwner );
1263+ stateTracker .actionStarted (new ActionStartedEvent (action , clock .nanoTime ()));
1264+ }
12391265 clock .advanceMillis (TimeUnit .SECONDS .toMillis (1 ));
12401266
12411267 LoggingTerminalWriter terminalWriter = new LoggingTerminalWriter (/*discardHighlight=*/ true );
@@ -1251,6 +1277,8 @@ public void testAggregation() throws Exception {
12511277 assertWithMessage ("Progress bar should contain 'Other action', but was:\n " + output )
12521278 .that (output .contains ("Other action" ))
12531279 .isTrue ();
1280+ assertThat (output ).doesNotContain ("Testing //baz:baztest" );
1281+ assertThat (output ).contains ("Doing something" );
12541282 }
12551283
12561284 @ Test
0 commit comments