From b9d8a47872050ca5fe6c1b95fcb0534e6e0ebc3d Mon Sep 17 00:00:00 2001 From: Mindaugas Malinauskas Date: Tue, 4 Apr 2023 18:27:25 +0000 Subject: SERVER-66715 Add tenant lock --- jstests/serverless/change_stream_state_commands.js | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'jstests/serverless/change_stream_state_commands.js') diff --git a/jstests/serverless/change_stream_state_commands.js b/jstests/serverless/change_stream_state_commands.js index c7196e7a104..f6fdcb6eb61 100644 --- a/jstests/serverless/change_stream_state_commands.js +++ b/jstests/serverless/change_stream_state_commands.js @@ -9,6 +9,10 @@ load("jstests/libs/fail_point_util.js"); // For configureFailPoint. load('jstests/libs/parallel_shell_helpers.js'); // For funWithArgs. +// Disable implicit sessions since dropping "config" database for a tenant must be done not in a +// session. +TestData.disableImplicitSessions = true; + const replSetTest = new ReplSetTest({nodes: 2, name: "change-stream-state-commands", serverless: true}); @@ -104,6 +108,12 @@ const secondOrgTenantId = ObjectId(); setChangeStreamState(firstOrgTenantId, false); setChangeStreamState(firstOrgTenantId, false); assertChangeStreamState(firstOrgTenantId, false); + + // Verify that dropping "config" database works and effectively disables change streams. + setChangeStreamState(firstOrgTenantId, true); + assert.commandWorked(replSetTest.getPrimary().getDB("config").runCommand( + {dropDatabase: 1, $tenant: firstOrgTenantId})); + assertChangeStreamState(firstOrgTenantId, false); })(); // Tests that the 'setChangeStreamState' command tolerates the primary step-down and can @@ -302,4 +312,5 @@ const secondOrgTenantId = ObjectId(); })(); replSetTest.stopSet(); +TestData.disableImplicitSessions = false; }()); -- cgit v1.2.1