From 0e2331e0d62fdfad336d17891276bd7706764390 Mon Sep 17 00:00:00 2001 From: Kevin Mas Ruiz Date: Mon, 25 Aug 2025 16:03:49 +0200 Subject: [PATCH 1/2] chore: add dependency to kerberos This is necessary for clients that can use kerberos. It's registered as an optional dependency so clients that can't use kerberos because they don't have the required system dependencies can still use the MCP Server w/o kerberos support. --- package-lock.json | 4 ++++ package.json | 3 +++ 2 files changed, 7 insertions(+) diff --git a/package-lock.json b/package-lock.json index 9312b54ba..40176e2ec 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,6 +18,7 @@ "@vitest/eslint-plugin": "^1.3.4", "bson": "^6.10.4", "express": "^5.1.0", + "kerberos": "*", "lru-cache": "^11.1.0", "mongodb": "^6.17.0", "mongodb-connection-string-url": "^3.0.2", @@ -73,6 +74,9 @@ }, "engines": { "node": "^20.19.0 || ^22.12.0 || >= 23.0.0" + }, + "optionalDependencies": { + "kerberos": "^2.2.2" } }, "@himanshusinghs/ai-sdk-google": { diff --git a/package.json b/package.json index db6afc394..c5927d242 100644 --- a/package.json +++ b/package.json @@ -119,5 +119,8 @@ }, "engines": { "node": "^20.19.0 || ^22.12.0 || >= 23.0.0" + }, + "optionalDependencies": { + "kerberos": "^2.2.2" } } From f11d8dcf002efe55e81487ff627fe8711b412e98 Mon Sep 17 00:00:00 2001 From: Kevin Mas Ruiz Date: Mon, 25 Aug 2025 16:18:22 +0200 Subject: [PATCH 2/2] chore: add retries to flaky test This test requires loading eventual consistent data, and sometimes it returns undefined even if the connection was successful. --- .../common/connectionManager.oidc.test.ts | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/tests/integration/common/connectionManager.oidc.test.ts b/tests/integration/common/connectionManager.oidc.test.ts index 78ff84782..a14a5ab4b 100644 --- a/tests/integration/common/connectionManager.oidc.test.ts +++ b/tests/integration/common/connectionManager.oidc.test.ts @@ -1,5 +1,5 @@ import type { TestContext } from "vitest"; -import { describe, beforeEach, afterAll, it, expect } from "vitest"; +import { describe, beforeEach, afterAll, it, expect, vi } from "vitest"; import semver from "semver"; import process from "process"; import type { MongoDBIntegrationTestCase } from "../tools/mongodb/mongodbHelpers.js"; @@ -168,11 +168,22 @@ describe.skipIf(process.platform !== "linux")("ConnectionManager OIDC Tests", as }; }; - const status: ConnectionStatus = (await state.serviceProvider.runCommand("admin", { - connectionStatus: 1, - })) as unknown as ConnectionStatus; + const status: ConnectionStatus = await vi.waitFor(async () => { + const result: ConnectionStatus = (await state.serviceProvider.runCommand("admin", { + connectionStatus: 1, + })) as unknown as ConnectionStatus; - expect(status.authInfo.authenticatedUsers[0]).toEqual({ user: "dev/testuser", db: "$external" }); + if (!result) { + throw new Error("Status can not be undefined. Retrying."); + } + + return result; + }); + + expect(status.authInfo.authenticatedUsers[0]).toEqual({ + user: "dev/testuser", + db: "$external", + }); expect(status.authInfo.authenticatedUserRoles[0]).toEqual({ role: "dev/mocktaTestServer-group", db: "admin",