Skip to content

Commit 29f46d0

Browse files
committed
[grid] Doing .countDown() when the right event has been listened to
1 parent b2cf065 commit 29f46d0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

java/server/test/org/openqa/selenium/grid/distributor/DistributorTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,20 +183,20 @@ public void shouldStartHeartBeatOnNodeRegistration() {
183183
CountDownLatch latch = new CountDownLatch(1);
184184

185185
bus.addListener(NodeHeartBeatEvent.listener(nodeStatus -> {
186-
latch.countDown();
187186
if (node.getId().equals(nodeStatus.getId())) {
187+
latch.countDown();
188188
heartbeatStarted.set(true);
189189
}
190190
}));
191191
waitToHaveCapacity(distributor);
192-
boolean eventFired = false;
192+
boolean eventFiredAndListenedTo = false;
193193
try {
194-
eventFired = latch.await(30, TimeUnit.SECONDS);
194+
eventFiredAndListenedTo = latch.await(30, TimeUnit.SECONDS);
195195
} catch (InterruptedException e) {
196196
Assert.fail("Thread Interrupted");
197197
}
198198

199-
assertThat(eventFired).isTrue();
199+
assertThat(eventFiredAndListenedTo).isTrue();
200200
assertThat(heartbeatStarted.get()).isTrue();
201201
}
202202

0 commit comments

Comments
 (0)