Skip to content

Commit db4e29c

Browse files
tcheericclaude
andcommitted
fix(test): add await for server connection registration in idempotent test
The connectIsIdempotentWhenConnected test was flaky because it checked mockRelay.getConnectionCount() immediately after client.connect() returned. Due to async nature, the server's onOpen callback may not have executed yet. Added mockRelay.awaitConnection() to wait for server-side connection registration before asserting connection count. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent f0ee151 commit db4e29c

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

nsecbunker-tests/nsecbunker-it/src/test/java/xyz/tcheeric/nsecbunker/admin/integration/AdminConnectionLifecycleTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ void connectIsIdempotentWhenConnected() throws Exception {
8686

8787
client.connect();
8888
assertThat(client.isConnected()).isTrue();
89+
// Wait for server to register the connection
90+
assertThat(mockRelay.awaitConnection(5, TimeUnit.SECONDS)).isTrue();
8991

9092
// Second connect should not throw
9193
client.connect();

0 commit comments

Comments
 (0)