Skip to content

Commit

Permalink
[Java] Fix test race.
Browse files Browse the repository at this point in the history
  • Loading branch information
vyazelenko committed Oct 25, 2024
1 parent 22a0f60 commit 8f8d019
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@
import java.util.concurrent.atomic.AtomicInteger;

import static java.util.Arrays.asList;
import static org.hamcrest.MatcherAssert.*;
import static org.hamcrest.Matchers.*;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

Expand Down Expand Up @@ -223,9 +220,10 @@ void shouldRejoinAfterResting(final String channel)
aeron.conductorAgentInvoker().invoke();
}

final Image tetheredImage = tetheredSub.imageAtIndex(0);
final Image untetheredImage = untetheredSub.imageAtIndex(0);
assertThat(untetheredImage.position(), lessThan(publication.position()));
while (untetheredImage.position() < publication.position())
while (untetheredImage.position() < publication.position() ||
tetheredImage.position() < publication.position())
{
int fragments = 0;
fragments += tetheredSub.poll(fragmentHandler, FRAGMENT_COUNT_LIMIT);
Expand All @@ -236,7 +234,6 @@ void shouldRejoinAfterResting(final String channel)
aeron.conductorAgentInvoker().invoke();
}
}
assertEquals(publication.position(), tetheredSub.imageAtIndex(0).position());
}
}
}

0 comments on commit 8f8d019

Please sign in to comment.