-
Notifications
You must be signed in to change notification settings - Fork 121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test cleanup #524
Test cleanup #524
Conversation
@@ -89,6 +90,8 @@ public final class BinaryEntryPointClient implements AutoCloseable | |||
private long keepAliveIntervalInMs = KEEP_ALIVE_INTERVAL_IN_MS; | |||
private CancelOnDisconnectType cancelOnDisconnectType = DO_NOT_CANCEL_ON_DISCONNECT_OR_TERMINATE; | |||
private long codTimeoutWindow = DeltaInMillisEncoder.timeNullValue(); | |||
private static final OtfHeaderDecoder OTF_HEADER_DECODER = new OtfHeaderDecoder( | |||
BinaryEntryPointProtocol.loadSbeIr().headerStructure()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this instead of a regular MessageHeaderDecoder
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is what the JsonPrinter.print
method uses. I've just reproduced the issue and it happens when we run shouldDisconnectConnectionWhenOutOfRangeTemplateIdUsed()
test with FIX_TEST log tag enabled.
@@ -332,8 +335,15 @@ private void print(final UnsafeBuffer unsafeReadBuffer, final String prefixStrin | |||
if (DebugLogger.isEnabled(FIX_TEST)) | |||
{ | |||
final StringBuilder sb = new StringBuilder(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move into the if too.
@@ -216,7 +216,7 @@ private void assertTriggersCancelOnDisconnect(final long logoutTimeInNs) | |||
assertEquals(onlySession.key(), result.context.key()); | |||
final long timeoutTakenInNs = result.timeInNs - logoutTimeInNs; | |||
assertThat(timeoutTakenInNs, greaterThanOrEqualTo(codTimeoutInNs)); | |||
assertEquals(1, timeoutHandler.invokeCount()); | |||
testSystem.await("timeoutHandler.invokeCount() is not 1", () -> 1 == timeoutHandler.invokeCount()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this fails you will lose the actual invokeCount.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as I said privately I'd prefer refactoring this await method later on as it's being used in a bunch of tests - for now i'm just reusing it.
static void assertReceivedResendRequest( | ||
final TestSystem testSystem, final FakeOtfAcceptor acceptor, final int msgSeqNo) | ||
{ | ||
assertEventuallyTrue("Failed to received heartbeat", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
receive resend request
} | ||
libraries.forEach((library) -> library.poll(LIBRARY_LIMIT)); | ||
final int result = resultInvokeFramer + libraries.stream().mapToInt((library) -> | ||
library.poll(LIBRARY_LIMIT)).sum(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not use streams here.
@@ -53,6 +53,7 @@ | |||
|
|||
public class TestSystem | |||
{ | |||
final ExecutorService executor = Executors.newSingleThreadExecutor(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private
@@ -1134,6 +1147,16 @@ private void exchangeMessagesAroundARestart( | |||
assertSequenceFromInitToAcceptAt(expectedInitToAccSeqNum, expectedAccToInitSeqNum); | |||
} | |||
|
|||
// this means a resend request will be sent by the acceptor | |||
if (initialSentSequenceNumber > expectedAccToInitSeqNum) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aren't you comparing sequence numbers across two different directions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeh - am fixing the logic - thx
8e4f925
to
fbed143
Compare
static void assertReceivedResendRequest( | ||
final TestSystem testSystem, final FakeOtfAcceptor acceptor, final int msgSeqNo) | ||
{ | ||
assertEventuallyTrue("Failed to receive resent request", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resend
- returning workCount and trySend result to improve debugging
- SlowConsumerTest.sendMessage call is now protected against back pressure as it's now wrapped around a awaitSend call.
…t receives D replay before live msg
…not fail when FIXP logtag is enabled
-fixing BinaryEntryPointClient call to jsonPrint when FIX_TEST is enabled -cancelOnDisconnect test was using wrong assumption on logout time
…outHandler.invokeCount set
fbed143
to
ef019e9
Compare
No description provided.