summaryrefslogtreecommitdiff
path: root/src/mongo/db/auth/authorization_session_test_fixture.cpp
diff options
context:
space:
mode:
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);