Skip to content

Commit 0b699ff

Browse files
committed
Test fallback to legacy hello after connection is closed
1 parent b56f3a2 commit 0b699ff

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/libmongoc/tests/test-mongoc-topology.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2366,8 +2366,16 @@ _test_hello_ok (bool pooled)
23662366
client, "admin", tmp_bson ("{'ping': 1}"), NULL, NULL, &error);
23672367
}
23682368

2369+
/* Hang up to ensure that the next check runs legacy hello again */
23692370
request = mock_server_receives_hello (server);
23702371
BSON_ASSERT (request);
2372+
mock_server_hangs_up (request);
2373+
request_destroy (request);
2374+
2375+
/* The previous failure will trigger another handshake using legacy hello */
2376+
request = mock_server_receives_legacy_hello (
2377+
server, "{'" HANDSHAKE_CMD_LEGACY_HELLO "': 1, 'helloOk': true}");
2378+
BSON_ASSERT (request);
23712379
mock_server_replies_simple (request, hello);
23722380
request_destroy (request);
23732381

0 commit comments

Comments
 (0)