Skip to content

Commit 7e28a7e

Browse files
authored
chore: move perf advisor to long running tests - MCP-269 (#674)
1 parent 698093e commit 7e28a7e

File tree

4 files changed

+50
-2
lines changed

4 files changed

+50
-2
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
name: Code Health Long Running Tests
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch: # Allow manual triggering of the workflow in feature branches
8+
9+
permissions: {}
10+
11+
jobs:
12+
run-long-running-tests:
13+
name: Run long running tests
14+
if: github.event_name == 'push' || (github.event.pull_request.user.login != 'dependabot[bot]' && github.event.pull_request.head.repo.full_name == github.repository)
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: GitHubSecurityLab/actions-permissions/monitor@v1
18+
- uses: actions/checkout@v5
19+
- uses: actions/setup-node@v6
20+
with:
21+
node-version-file: package.json
22+
cache: "npm"
23+
- name: Install dependencies
24+
run: npm ci
25+
- name: Run tests
26+
env:
27+
MDB_MCP_API_CLIENT_ID: ${{ secrets.TEST_ATLAS_CLIENT_ID }}
28+
MDB_MCP_API_CLIENT_SECRET: ${{ secrets.TEST_ATLAS_CLIENT_SECRET }}
29+
MDB_MCP_API_BASE_URL: ${{ vars.TEST_ATLAS_BASE_URL }}
30+
run: npm test -- tests/integration/tools/atlas --project=long-running-tests
31+
- name: Upload test results
32+
uses: actions/upload-artifact@v4
33+
if: always()
34+
with:
35+
name: atlas-test-results
36+
path: coverage/lcov.info

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
"test": "vitest --project eslint-rules --project unit-and-integration --coverage",
5757
"pretest:accuracy": "npm run build",
5858
"test:accuracy": "sh ./scripts/accuracy/runAccuracyTests.sh",
59+
"test:long-running-tests": "vitest --project long-running-tests --coverage",
5960
"atlas:cleanup": "vitest --project atlas-cleanup"
6061
},
6162
"license": "Apache-2.0",

tests/integration/helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export const defaultTestConfig: UserConfig = {
5959
loggers: ["stderr"],
6060
};
6161

62-
export const DEFAULT_LONG_RUNNING_TEST_WAIT_TIMEOUT_MS = 900_000;
62+
export const DEFAULT_LONG_RUNNING_TEST_WAIT_TIMEOUT_MS = 1_200_000;
6363

6464
export function setupIntegrationTest(
6565
getUserConfig: () => UserConfig,

vitest.config.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ const vitestDefaultExcludes = [
1010
"**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*",
1111
];
1212

13+
const longRunningTests = ["tests/integration/tools/atlas/performanceAdvisor.test.ts"];
14+
1315
if (process.env.SKIP_ATLAS_TESTS === "true") {
1416
vitestDefaultExcludes.push("**/atlas/**");
1517
}
@@ -34,7 +36,7 @@ export default defineConfig({
3436
test: {
3537
name: "unit-and-integration",
3638
include: ["**/*.test.ts"],
37-
exclude: [...vitestDefaultExcludes, "scripts/**", "tests/accuracy/**"],
39+
exclude: [...vitestDefaultExcludes, "scripts/**", "tests/accuracy/**", ...longRunningTests],
3840
},
3941
},
4042
{
@@ -58,6 +60,15 @@ export default defineConfig({
5860
include: ["scripts/cleanupAtlasTestLeftovers.test.ts"],
5961
},
6062
},
63+
{
64+
extends: true,
65+
test: {
66+
name: "long-running-tests",
67+
include: [...longRunningTests],
68+
testTimeout: 7200000, // 2 hours for long-running tests
69+
hookTimeout: 7200000,
70+
},
71+
},
6172
],
6273
},
6374
});

0 commit comments

Comments
 (0)