Skip to content

Commit

Permalink
[Java] Fix assertion when running with C media driver on Windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
vyazelenko committed Nov 22, 2024
1 parent 2aa1ab1 commit de39fa6
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.agrona.CloseHelper;
import org.agrona.DirectBuffer;
import org.agrona.ErrorHandler;
import org.agrona.SystemUtil;
import org.agrona.collections.MutableInteger;
import org.agrona.collections.MutableLong;
import org.agrona.concurrent.UnsafeBuffer;
Expand Down Expand Up @@ -779,15 +780,17 @@ void shouldMergeStreamsFromMultiplePublicationsWithSameParams()
"aeron:udp?endpoint=localhost:8889" })
void shouldNotReuseEndpointAcrossMultipleSubscriptionsIfAtLeastOneIsMds(final String channel)
{
testWatcher.ignoreErrorsMatching((err) -> err.contains("Address already in use"));
final String errorMsg = SystemUtil.isWindows() && TestMediaDriver.shouldRunCMediaDriver() ?
"failed to bind to address" : "Address already in use";
testWatcher.ignoreErrorsMatching((err) -> err.contains(errorMsg));
launch(mock(ErrorHandler.class));

try (Subscription sub1 = clientA.addSubscription(channel, STREAM_ID);
Subscription mdsSubscription = clientA.addSubscription("aeron:udp?control-mode=manual", STREAM_ID))
{
final RegistrationException exception =
assertThrowsExactly(RegistrationException.class, () -> mdsSubscription.addDestination(sub1.channel()));
assertThat(exception.getMessage(), containsString("Address already in use"));
assertThat(exception.getMessage(), containsString(errorMsg));

Tests.await(() -> 1 == clientA.countersReader().getCounterValue(SystemCounterDescriptor.ERRORS.id()));
}
Expand All @@ -798,7 +801,7 @@ void shouldNotReuseEndpointAcrossMultipleSubscriptionsIfAtLeastOneIsMds(final St

final RegistrationException exception =
assertThrowsExactly(RegistrationException.class, () -> clientA.addSubscription(channel, STREAM_ID));
assertThat(exception.getMessage(), containsString("Address already in use"));
assertThat(exception.getMessage(), containsString(errorMsg));

Tests.await(() -> 2 == clientA.countersReader().getCounterValue(SystemCounterDescriptor.ERRORS.id()));
}
Expand All @@ -809,7 +812,7 @@ void shouldNotReuseEndpointAcrossMultipleSubscriptionsIfAtLeastOneIsMds(final St
mdsSubscription1.addDestination(channel);
final RegistrationException exception =
assertThrowsExactly(RegistrationException.class, () -> mdsSubscription2.addDestination(channel));
assertThat(exception.getMessage(), containsString("Address already in use"));
assertThat(exception.getMessage(), containsString(errorMsg));

Tests.await(() -> 3 == clientA.countersReader().getCounterValue(SystemCounterDescriptor.ERRORS.id()));
}
Expand Down

0 comments on commit de39fa6

Please sign in to comment.