From c79c5a680e5123a1c26a4b933649c395be8c33fa Mon Sep 17 00:00:00 2001 From: Bianca Lisle Date: Tue, 21 Oct 2025 18:18:39 +0100 Subject: [PATCH 1/7] wip --- package.json | 1 + vitest.config.ts | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 3a843a15a..54a0f0d6f 100644 --- a/package.json +++ b/package.json @@ -56,6 +56,7 @@ "test": "vitest --project eslint-rules --project unit-and-integration --coverage", "pretest:accuracy": "npm run build", "test:accuracy": "sh ./scripts/accuracy/runAccuracyTests.sh", + "test:atlas": "vitest --project atlas-long-running --coverage", "atlas:cleanup": "vitest --project atlas-cleanup" }, "license": "Apache-2.0", diff --git a/vitest.config.ts b/vitest.config.ts index 69fdcc642..1aade13c3 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -10,6 +10,10 @@ const vitestDefaultExcludes = [ "**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*", ]; +const longRunningTests = [ + "tests/integration/tools/atlas/performanceAdvisor.test.ts", +]; + if (process.env.SKIP_ATLAS_TESTS === "true") { vitestDefaultExcludes.push("**/atlas/**"); } @@ -18,6 +22,7 @@ if (process.env.SKIP_ATLAS_LOCAL_TESTS === "true") { vitestDefaultExcludes.push("**/atlas-local/**"); } + export default defineConfig({ test: { environment: "node", @@ -34,7 +39,7 @@ export default defineConfig({ test: { name: "unit-and-integration", include: ["**/*.test.ts"], - exclude: [...vitestDefaultExcludes, "scripts/**", "tests/accuracy/**"], + exclude: [...vitestDefaultExcludes, "scripts/**", "tests/accuracy/**", ...longRunningTests], }, }, { @@ -58,6 +63,15 @@ export default defineConfig({ include: ["scripts/cleanupAtlasTestLeftovers.test.ts"], }, }, + { + extends: true, + test: { + name: "atlas-long-running", + include: [...longRunningTests], + testTimeout: 7200000, // 2 hours for long-running tests + hookTimeout: 7200000, + }, + }, ], }, }); From 48275c3051a35e81e93d417d757a6f197d5712fb Mon Sep 17 00:00:00 2001 From: Bianca Lisle Date: Wed, 22 Oct 2025 11:49:18 +0100 Subject: [PATCH 2/7] update package name --- package.json | 2 +- vitest.config.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 54a0f0d6f..630579f6e 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "test": "vitest --project eslint-rules --project unit-and-integration --coverage", "pretest:accuracy": "npm run build", "test:accuracy": "sh ./scripts/accuracy/runAccuracyTests.sh", - "test:atlas": "vitest --project atlas-long-running --coverage", + "test:long-running-tests": "vitest --project atlas-long-running --coverage", "atlas:cleanup": "vitest --project atlas-cleanup" }, "license": "Apache-2.0", diff --git a/vitest.config.ts b/vitest.config.ts index 1aade13c3..5f93b2d72 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -66,7 +66,7 @@ export default defineConfig({ { extends: true, test: { - name: "atlas-long-running", + name: "long-running-tests", include: [...longRunningTests], testTimeout: 7200000, // 2 hours for long-running tests hookTimeout: 7200000, From 926e12e1e6fb6e94c5494978b827ebe66e5e7fe7 Mon Sep 17 00:00:00 2001 From: Bianca Lisle Date: Wed, 22 Oct 2025 11:52:34 +0100 Subject: [PATCH 3/7] update perf advisor timeout back to original value --- tests/integration/helpers.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/helpers.ts b/tests/integration/helpers.ts index 93fa30643..78560f52b 100644 --- a/tests/integration/helpers.ts +++ b/tests/integration/helpers.ts @@ -59,7 +59,7 @@ export const defaultTestConfig: UserConfig = { loggers: ["stderr"], }; -export const DEFAULT_LONG_RUNNING_TEST_WAIT_TIMEOUT_MS = 900_000; +export const DEFAULT_LONG_RUNNING_TEST_WAIT_TIMEOUT_MS = 1_200_000; export function setupIntegrationTest( getUserConfig: () => UserConfig, From aa200c160586ea9f43c0b28a83af06587f44a89d Mon Sep 17 00:00:00 2001 From: Bianca Lisle Date: Wed, 22 Oct 2025 11:54:26 +0100 Subject: [PATCH 4/7] lint --- vitest.config.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/vitest.config.ts b/vitest.config.ts index 5f93b2d72..854e165c4 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -10,9 +10,7 @@ const vitestDefaultExcludes = [ "**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*", ]; -const longRunningTests = [ - "tests/integration/tools/atlas/performanceAdvisor.test.ts", -]; +const longRunningTests = ["tests/integration/tools/atlas/performanceAdvisor.test.ts"]; if (process.env.SKIP_ATLAS_TESTS === "true") { vitestDefaultExcludes.push("**/atlas/**"); @@ -22,7 +20,6 @@ if (process.env.SKIP_ATLAS_LOCAL_TESTS === "true") { vitestDefaultExcludes.push("**/atlas-local/**"); } - export default defineConfig({ test: { environment: "node", From 14d292c7d240c10499e462652b11422e44eaa478 Mon Sep 17 00:00:00 2001 From: Bianca Lisle <40155621+blva@users.noreply.github.com> Date: Wed, 22 Oct 2025 11:55:51 +0100 Subject: [PATCH 5/7] Update package.json Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 630579f6e..ca4e48e52 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "test": "vitest --project eslint-rules --project unit-and-integration --coverage", "pretest:accuracy": "npm run build", "test:accuracy": "sh ./scripts/accuracy/runAccuracyTests.sh", - "test:long-running-tests": "vitest --project atlas-long-running --coverage", + "test:long-running-tests": "vitest --project long-running-tests --coverage", "atlas:cleanup": "vitest --project atlas-cleanup" }, "license": "Apache-2.0", From 0122fa0b3296cbf97d3ee24fd16c382feedd5080 Mon Sep 17 00:00:00 2001 From: Bianca Lisle Date: Wed, 22 Oct 2025 12:04:07 +0100 Subject: [PATCH 6/7] add gh action --- .../workflows/code-health-long-running.yml | 99 +++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 .github/workflows/code-health-long-running.yml diff --git a/.github/workflows/code-health-long-running.yml b/.github/workflows/code-health-long-running.yml new file mode 100644 index 000000000..195fbeb24 --- /dev/null +++ b/.github/workflows/code-health-long-running.yml @@ -0,0 +1,99 @@ +--- +name: Code Health Long Running Tests +on: + push: + branches: + - main + workflow_dispatch: # Allow manual triggering of the workflow in feature branches + +permissions: {} + +jobs: + run-tests: + name: Run MongoDB long running tests + if: github.event_name == 'push' || (github.event.pull_request.user.login != 'dependabot[bot]' && github.event.pull_request.head.repo.full_name == github.repository) + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + fail-fast: false + runs-on: ${{ matrix.os }} + steps: + - uses: GitHubSecurityLab/actions-permissions/monitor@v1 + if: matrix.os == 'ubuntu-latest' + - uses: actions/checkout@v5 + - uses: docker/setup-docker-action@v4 + if: matrix.os == 'ubuntu-latest' + name: Setup Docker Environment + with: + set-host: true + - uses: actions/setup-node@v6 + with: + node-version-file: package.json + cache: "npm" + - name: Install dependencies + run: npm ci + - name: Run tests + run: npm test + - name: Upload test results + if: always() && matrix.os == 'ubuntu-latest' + uses: actions/upload-artifact@v4 + with: + name: test-results + path: coverage/lcov.info + + run-long-running-tests: + name: Run long running tests + if: github.event_name == 'push' || (github.event.pull_request.user.login != 'dependabot[bot]' && github.event.pull_request.head.repo.full_name == github.repository) + runs-on: ubuntu-latest + steps: + - uses: GitHubSecurityLab/actions-permissions/monitor@v1 + - uses: actions/checkout@v5 + - uses: actions/setup-node@v6 + with: + node-version-file: package.json + cache: "npm" + - name: Install dependencies + run: npm ci + - name: Run tests + env: + MDB_MCP_API_CLIENT_ID: ${{ secrets.TEST_ATLAS_CLIENT_ID }} + MDB_MCP_API_CLIENT_SECRET: ${{ secrets.TEST_ATLAS_CLIENT_SECRET }} + MDB_MCP_API_BASE_URL: ${{ vars.TEST_ATLAS_BASE_URL }} + run: npm test -- tests/integration/tools/atlas --project=long-running-tests + - name: Upload test results + uses: actions/upload-artifact@v4 + if: always() + with: + name: atlas-test-results + path: coverage/lcov.info + + coverage: + name: Report Coverage + if: always() && (github.event_name == 'push' || (github.event.pull_request.user.login != 'dependabot[bot]' && github.event.pull_request.head.repo.full_name == github.repository)) + runs-on: ubuntu-latest + needs: [run-tests, run-long-running-tests] + steps: + - uses: actions/checkout@v5 + - uses: actions/setup-node@v6 + with: + node-version-file: package.json + cache: "npm" + - name: Install dependencies + run: npm ci + - name: Download test results + uses: actions/download-artifact@v5 + with: + name: test-results + path: coverage/mongodb + - name: Download atlas test results + uses: actions/download-artifact@v5 + with: + name: atlas-test-results + path: coverage/atlas + - name: Merge coverage reports + run: | + npx -y lcov-result-merger@5.0.1 "coverage/*/lcov.info" "coverage/lcov.info" + - name: Coveralls GitHub Action + uses: coverallsapp/github-action@v2.3.6 + with: + file: coverage/lcov.info From ec48e82c72ef3475ba0d4c817d387e680fd12664 Mon Sep 17 00:00:00 2001 From: Bianca Lisle Date: Wed, 22 Oct 2025 12:06:06 +0100 Subject: [PATCH 7/7] clean up jobs --- .../workflows/code-health-long-running.yml | 63 ------------------- 1 file changed, 63 deletions(-) diff --git a/.github/workflows/code-health-long-running.yml b/.github/workflows/code-health-long-running.yml index 195fbeb24..ee94c30ca 100644 --- a/.github/workflows/code-health-long-running.yml +++ b/.github/workflows/code-health-long-running.yml @@ -9,38 +9,6 @@ on: permissions: {} jobs: - run-tests: - name: Run MongoDB long running tests - if: github.event_name == 'push' || (github.event.pull_request.user.login != 'dependabot[bot]' && github.event.pull_request.head.repo.full_name == github.repository) - strategy: - matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - fail-fast: false - runs-on: ${{ matrix.os }} - steps: - - uses: GitHubSecurityLab/actions-permissions/monitor@v1 - if: matrix.os == 'ubuntu-latest' - - uses: actions/checkout@v5 - - uses: docker/setup-docker-action@v4 - if: matrix.os == 'ubuntu-latest' - name: Setup Docker Environment - with: - set-host: true - - uses: actions/setup-node@v6 - with: - node-version-file: package.json - cache: "npm" - - name: Install dependencies - run: npm ci - - name: Run tests - run: npm test - - name: Upload test results - if: always() && matrix.os == 'ubuntu-latest' - uses: actions/upload-artifact@v4 - with: - name: test-results - path: coverage/lcov.info - run-long-running-tests: name: Run long running tests if: github.event_name == 'push' || (github.event.pull_request.user.login != 'dependabot[bot]' && github.event.pull_request.head.repo.full_name == github.repository) @@ -66,34 +34,3 @@ jobs: with: name: atlas-test-results path: coverage/lcov.info - - coverage: - name: Report Coverage - if: always() && (github.event_name == 'push' || (github.event.pull_request.user.login != 'dependabot[bot]' && github.event.pull_request.head.repo.full_name == github.repository)) - runs-on: ubuntu-latest - needs: [run-tests, run-long-running-tests] - steps: - - uses: actions/checkout@v5 - - uses: actions/setup-node@v6 - with: - node-version-file: package.json - cache: "npm" - - name: Install dependencies - run: npm ci - - name: Download test results - uses: actions/download-artifact@v5 - with: - name: test-results - path: coverage/mongodb - - name: Download atlas test results - uses: actions/download-artifact@v5 - with: - name: atlas-test-results - path: coverage/atlas - - name: Merge coverage reports - run: | - npx -y lcov-result-merger@5.0.1 "coverage/*/lcov.info" "coverage/lcov.info" - - name: Coveralls GitHub Action - uses: coverallsapp/github-action@v2.3.6 - with: - file: coverage/lcov.info