Skip to content

Commit

Permalink
[Java] Increase default timeout to 10 seconds to account for slow DNS…
Browse files Browse the repository at this point in the history
… queries on MacOS.
  • Loading branch information
vyazelenko committed Jan 3, 2024
1 parent bb7ca6d commit 36c47f2
Showing 1 changed file with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
import static org.mockito.Mockito.mock;

@ExtendWith(InterruptingTestCallback.class)
@InterruptAfter(10)
class SessionSpecificSubscriptionTest
{
private static final String ENDPOINT = "localhost:24325";
Expand Down Expand Up @@ -93,7 +94,6 @@ void after()
driver.context().deleteDirectory();
}

@InterruptAfter(10)
@ParameterizedTest
@MethodSource("data")
void shouldSubscribeToSpecificSessionIdsAndWildcard(final ChannelUriStringBuilder channelBuilder)
Expand Down Expand Up @@ -184,7 +184,6 @@ void shouldNotSubscribeWithoutSpecificSession(final ChannelUriStringBuilder chan

@ParameterizedTest
@MethodSource("data")
@InterruptAfter(5)
void shouldOnlySeeDataOnSpecificSessionWhenUsingTags(final ChannelUriStringBuilder channelBuilder)
{
final DirectBuffer liveBuffer = new UnsafeBuffer("live".getBytes(StandardCharsets.US_ASCII));
Expand Down Expand Up @@ -228,24 +227,25 @@ void shouldOnlySeeDataOnSpecificSessionWhenUsingTags(final ChannelUriStringBuild
final long deadlineMs = System.currentTimeMillis() + 2_000;
final IdleStrategy idleStrategy = new YieldingIdleStrategy();

int fragments = 0;
while (System.currentTimeMillis() < deadlineMs)
final FragmentHandler fragmentHandler = (buffer, offset, length, header) ->
{
fragments += tagOnlySub.poll(
(buffer, offset, length, header) ->
{
final String s = buffer.getStringWithoutLengthAscii(offset, length);
if ("ignored".equals(s))
{
isValid.set(false);
}
}, 10);
final String s = buffer.getStringWithoutLengthAscii(offset, length);
if ("ignored".equals(s))
{
isValid.set(false);
}
};

int totalFragments = 0;
while (System.currentTimeMillis() < deadlineMs)
{
final int fragments = tagOnlySub.poll(fragmentHandler, 10);
totalFragments += fragments;
idleStrategy.idle(fragments);
}

assertTrue(isValid.get());
assertEquals(1, fragments);
assertEquals(1, totalFragments);
}
}

Expand Down

0 comments on commit 36c47f2

Please sign in to comment.