Skip to content

Commit

Permalink
fix(MongoMemoryReplSet): fix creating auth regardless of "enableAuth"
Browse files Browse the repository at this point in the history
  • Loading branch information
hasezoey committed Sep 25, 2022
1 parent c958b07 commit 78d5aee
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/mongodb-memory-server-core/src/MongoMemoryReplSet.ts
Expand Up @@ -708,11 +708,12 @@ export class MongoMemoryReplSet extends EventEmitter implements ManagerAdvanced
log('_initReplSet: trying "replSetInitiate"');
await adminDb.command({ replSetInitiate: rsConfig });

if (typeof this._replSetOpts.auth === 'object') {
log('_initReplSet: "this._replSetOpts.auth" is a object');
if (this.enableAuth()) {
log('_initReplSet: "enableAuth" returned "true"');

await this._waitForPrimary(undefined, '_initReplSet authIsObject');

// find the primary instance to run createAuth on
const primary = this.servers.find(
(server) => server.instanceInfo?.instance.isInstancePrimary
);
Expand Down

0 comments on commit 78d5aee

Please sign in to comment.