Skip to content

Commit f42f64a

Browse files
committed
fix(test): adapt integration tests to post-auth watcher registration
- testAuthorization: auth response syncId is now 2 since IPROTO_WATCH is no longer allocated before the auth request (TNTP-10388) - testWatcherRecoveryAfterReconnect: call ping() after reconnect to re-trigger watcher registration, adjust sleep timings
1 parent da6f4f4 commit f42f64a

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

‎tarantool-core/src/test/java/io/tarantool/core/integration/IProtoClientTest.java‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ public class IProtoClientTest extends BaseTest {
8383

8484
private static final IProtoRequestOpts DEFAULT_REQUEST_OPTS =
8585
IProtoRequestOpts.empty().withRequestTimeout(5000);
86+
private static final long AUTH_SYNC_ID = 2;
8687
private static TarantoolContainer<?> tt;
8788
private static int spaceAId;
8889
private static int spaceBId;
@@ -1386,7 +1387,7 @@ public void testOperationsWithPushHandler() throws Exception {
13861387
public void testAuthorization() throws Exception {
13871388
IProtoClient client = createClientAndConnect(address, true);
13881389
IProtoMessage message = client.authorize("user_a", "secret_a").get();
1389-
checkMessageHeader(message, IPROTO_OK, 3);
1390+
checkMessageHeader(message, IPROTO_OK, AUTH_SYNC_ID);
13901391
assertEquals(0, message.getBody().asMapValue().map().size());
13911392
}
13921393

‎tarantool-core/src/test/java/io/tarantool/core/integration/IProtoClientWatchersTest.java‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,12 +179,17 @@ private void testWatcherRecoveryAfterReconnectOnContainer(
179179
"box.broadcast('keyA', 'myEvent');"
180180
+ "box.broadcast('keyB', {1, 2, 3});"
181181
+ "box.broadcast('keyC', 'wontbecaught');");
182+
// let the first broadcast events arrive before the connection is closed
182183
Thread.sleep(100);
183184
client.close();
184-
Thread.sleep(100);
185+
Thread.sleep(200);
185186
InetSocketAddress address = tt.mappedAddress();
186187
client.connect(address, 3_000).get();
187-
Thread.sleep(1000);
188+
// Re-trigger watcher registration after reconnect (same as getClientAndConnect)
189+
client.ping().get();
190+
// Give time for handleClose to finish clearing stateContext on the Netty thread
191+
// and for IPROTO_WATCH responses to arrive before sending new broadcast
192+
Thread.sleep(1500);
188193

189194
TarantoolContainerClientHelper.executeCommand(
190195
tt,

0 commit comments

Comments
 (0)