Skip to content

Commit

Permalink
Fix ElasticJobExecutorServiceTest Flakiness (#2242)
Browse files Browse the repository at this point in the history
Co-authored-by: other <other@ECE-A55006.austin.utexas.edu>
  • Loading branch information
Alisha-0321 and other authored Sep 5, 2023
1 parent 2dc90ee commit 53cbc73
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@

public final class ElasticJobExecutorServiceTest {

private static boolean hasExecuted;

@Test
public void assertCreateExecutorService() {
ElasticJobExecutorService executorServiceObject = new ElasticJobExecutorService("executor-service-test", 1);
Expand All @@ -48,13 +50,17 @@ public void assertCreateExecutorService() {
executorService.shutdownNow();
assertThat(executorServiceObject.getWorkQueueSize(), is(0));
assertTrue(executorServiceObject.isShutdown());
hasExecuted = true;
}

static class FooTask implements Runnable {

@Override
public void run() {
BlockUtils.sleep(1000L);
while (!hasExecuted) {
Thread.yield();
}
}
}
}

0 comments on commit 53cbc73

Please sign in to comment.