Skip to content

Commit 8f8d019

Browse files
committed
[Java] Fix test race.
1 parent 22a0f60 commit 8f8d019

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

aeron-system-tests/src/test/java/io/aeron/UntetheredSubscriptionTest.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@
4141
import java.util.concurrent.atomic.AtomicInteger;
4242

4343
import static java.util.Arrays.asList;
44-
import static org.hamcrest.MatcherAssert.*;
45-
import static org.hamcrest.Matchers.*;
46-
import static org.junit.jupiter.api.Assertions.assertEquals;
4744
import static org.junit.jupiter.api.Assertions.assertFalse;
4845
import static org.junit.jupiter.api.Assertions.assertTrue;
4946

@@ -223,9 +220,10 @@ void shouldRejoinAfterResting(final String channel)
223220
aeron.conductorAgentInvoker().invoke();
224221
}
225222

223+
final Image tetheredImage = tetheredSub.imageAtIndex(0);
226224
final Image untetheredImage = untetheredSub.imageAtIndex(0);
227-
assertThat(untetheredImage.position(), lessThan(publication.position()));
228-
while (untetheredImage.position() < publication.position())
225+
while (untetheredImage.position() < publication.position() ||
226+
tetheredImage.position() < publication.position())
229227
{
230228
int fragments = 0;
231229
fragments += tetheredSub.poll(fragmentHandler, FRAGMENT_COUNT_LIMIT);
@@ -236,7 +234,6 @@ void shouldRejoinAfterResting(final String channel)
236234
aeron.conductorAgentInvoker().invoke();
237235
}
238236
}
239-
assertEquals(publication.position(), tetheredSub.imageAtIndex(0).position());
240237
}
241238
}
242239
}

0 commit comments

Comments
 (0)