summaryrefslogtreecommitdiff
path: root/src/mongo/db/auth/authorization_session_test_fixture.cpp
diff options
context:
space:
mode:
authorLucas de Castro Borges <lucas@gnuabordo.com.br>2025-02-18 17:02:53 -0300
committerLucas de Castro Borges <lucas@gnuabordo.com.br>2025-02-18 17:02:53 -0300
commit959575a5ca598bf5f37fb5cebe7ed1d80d3d71f7 (patch)
treeacc8d60aedb12b70048e676e8a7349deb0010db8 /src/mongo/db/auth/authorization_session_test_fixture.cpp
parent76588293975fc059cf076779e4283e6ffaf8afff (diff)
New upstream version 6.0.20upstream
Diffstat (limited to 'src/mongo/db/auth/authorization_session_test_fixture.cpp')
-rw-r--r--src/mongo/db/auth/authorization_session_test_fixture.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/mongo/db/auth/authorization_session_test_fixture.cpp b/src/mongo/db/auth/authorization_session_test_fixture.cpp
index 330837ee719..db2500a6a2c 100644
--- a/src/mongo/db/auth/authorization_session_test_fixture.cpp
+++ b/src/mongo/db/auth/authorization_session_test_fixture.cpp
@@ -44,16 +44,18 @@
namespace mongo {
void AuthorizationSessionTestFixture::setUp() {
+ // AuthorizationManager must be initialized prior to creating Client objects.
+ auto localManagerState = std::make_unique<FailureCapableAuthzManagerExternalStateMock>();
+ managerState = localManagerState.get();
+ auto uniqueAuthzManager = std::make_unique<AuthorizationManagerImpl>(
+ getServiceContext(), std::move(localManagerState));
+
_session = transportLayer.createSession();
_client = getServiceContext()->makeClient("testClient", _session);
RestrictionEnvironment::set(_session,
std::make_unique<RestrictionEnvironment>(SockAddr(), SockAddr()));
_opCtx = _client->makeOperationContext();
- auto localManagerState = std::make_unique<FailureCapableAuthzManagerExternalStateMock>();
- managerState = localManagerState.get();
managerState->setAuthzVersion(AuthorizationManager::schemaVersion26Final);
- auto uniqueAuthzManager = std::make_unique<AuthorizationManagerImpl>(
- getServiceContext(), std::move(localManagerState));
authzManager = uniqueAuthzManager.get();
AuthorizationManager::set(getServiceContext(), std::move(uniqueAuthzManager));
auto localSessionState = std::make_unique<AuthzSessionExternalStateMock>(authzManager);