From cdb477928e83d35c6544a18f923eb3333d32fb80 Mon Sep 17 00:00:00 2001 From: Bianca Lisle Date: Thu, 2 Oct 2025 11:59:35 +0200 Subject: [PATCH 1/4] stop waiting for cluster deletion --- tests/integration/tools/atlas/clusters.test.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/tests/integration/tools/atlas/clusters.test.ts b/tests/integration/tools/atlas/clusters.test.ts index 5c50c570c..549418ff2 100644 --- a/tests/integration/tools/atlas/clusters.test.ts +++ b/tests/integration/tools/atlas/clusters.test.ts @@ -8,6 +8,8 @@ function sleep(ms: number): Promise { return new Promise((resolve) => setTimeout(resolve, ms)); } +// keeping it for cleanup scripts if needed +// eslint-disable-next-line @typescript-eslint/no-unused-vars async function deleteAndWaitCluster(session: Session, projectId: string, clusterName: string): Promise { await session.apiClient.deleteCluster({ params: { @@ -34,6 +36,17 @@ async function deleteAndWaitCluster(session: Session, projectId: string, cluster } } +async function deleteCluster(session: Session, projectId: string, clusterName: string): Promise { + await session.apiClient.deleteCluster({ + params: { + path: { + groupId: projectId, + clusterName, + }, + }, + }); +} + async function waitCluster( session: Session, projectId: string, @@ -64,7 +77,7 @@ describeWithAtlas("clusters", (integration) => { const projectId = getProjectId(); if (projectId) { const session: Session = integration.mcpServer().session; - await deleteAndWaitCluster(session, projectId, clusterName); + await deleteCluster(session, projectId, clusterName); } }); From 157e10d2e523c61fcc4e123abeee67f3b6bd7d60 Mon Sep 17 00:00:00 2001 From: Bianca Lisle Date: Thu, 2 Oct 2025 12:04:39 +0200 Subject: [PATCH 2/4] reuse deletion --- tests/integration/tools/atlas/clusters.test.ts | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/tests/integration/tools/atlas/clusters.test.ts b/tests/integration/tools/atlas/clusters.test.ts index 549418ff2..ec6b1bf9d 100644 --- a/tests/integration/tools/atlas/clusters.test.ts +++ b/tests/integration/tools/atlas/clusters.test.ts @@ -11,14 +11,7 @@ function sleep(ms: number): Promise { // keeping it for cleanup scripts if needed // eslint-disable-next-line @typescript-eslint/no-unused-vars async function deleteAndWaitCluster(session: Session, projectId: string, clusterName: string): Promise { - await session.apiClient.deleteCluster({ - params: { - path: { - groupId: projectId, - clusterName, - }, - }, - }); + await deleteCluster(session, projectId, clusterName); while (true) { try { await session.apiClient.getCluster({ From dc70c7adb9b898ebeefbad19f90b6daa71ff5207 Mon Sep 17 00:00:00 2001 From: Bianca Lisle Date: Thu, 2 Oct 2025 13:35:14 +0200 Subject: [PATCH 3/4] remove project clean up and update --- tests/integration/tools/atlas/atlasHelpers.ts | 16 +-------- .../integration/tools/atlas/clusters.test.ts | 34 +++++++++++-------- 2 files changed, 20 insertions(+), 30 deletions(-) diff --git a/tests/integration/tools/atlas/atlasHelpers.ts b/tests/integration/tools/atlas/atlasHelpers.ts index 00ac53feb..1d6ce84b7 100644 --- a/tests/integration/tools/atlas/atlasHelpers.ts +++ b/tests/integration/tools/atlas/atlasHelpers.ts @@ -4,7 +4,7 @@ import type { ApiClient } from "../../../../src/common/atlas/apiClient.js"; import type { IntegrationTest } from "../../helpers.js"; import { setupIntegrationTest, defaultTestConfig, defaultDriverOptions } from "../../helpers.js"; import type { SuiteCollector } from "vitest"; -import { afterAll, beforeAll, describe } from "vitest"; +import { beforeAll, describe } from "vitest"; export type IntegrationTestFunction = (integration: IntegrationTest) => void; @@ -60,20 +60,6 @@ export function withProject(integration: IntegrationTest, fn: ProjectTestFunctio } }); - afterAll(async () => { - const apiClient = integration.mcpServer().session.apiClient; - if (projectId) { - // projectId may be empty if beforeAll failed. - await apiClient.deleteProject({ - params: { - path: { - groupId: projectId, - }, - }, - }); - } - }); - const args = { getProjectId: (): string => projectId, getIpAddress: (): string => ipAddress, diff --git a/tests/integration/tools/atlas/clusters.test.ts b/tests/integration/tools/atlas/clusters.test.ts index ec6b1bf9d..0e666be7d 100644 --- a/tests/integration/tools/atlas/clusters.test.ts +++ b/tests/integration/tools/atlas/clusters.test.ts @@ -8,10 +8,25 @@ function sleep(ms: number): Promise { return new Promise((resolve) => setTimeout(resolve, ms)); } -// keeping it for cleanup scripts if needed -// eslint-disable-next-line @typescript-eslint/no-unused-vars -async function deleteAndWaitCluster(session: Session, projectId: string, clusterName: string): Promise { - await deleteCluster(session, projectId, clusterName); +async function deleteCluster( + session: Session, + projectId: string, + clusterName: string, + wait: boolean = false +): Promise { + await session.apiClient.deleteCluster({ + params: { + path: { + groupId: projectId, + clusterName, + }, + }, + }); + + if (!wait) { + return; + } + while (true) { try { await session.apiClient.getCluster({ @@ -29,17 +44,6 @@ async function deleteAndWaitCluster(session: Session, projectId: string, cluster } } -async function deleteCluster(session: Session, projectId: string, clusterName: string): Promise { - await session.apiClient.deleteCluster({ - params: { - path: { - groupId: projectId, - clusterName, - }, - }, - }); -} - async function waitCluster( session: Session, projectId: string, From 2564d550296751b8fff0bdeda92df85ef92f1e26 Mon Sep 17 00:00:00 2001 From: Bianca Lisle Date: Thu, 2 Oct 2025 13:51:59 +0200 Subject: [PATCH 4/4] update project deletion --- tests/integration/tools/atlas/atlasHelpers.ts | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/tests/integration/tools/atlas/atlasHelpers.ts b/tests/integration/tools/atlas/atlasHelpers.ts index 1d6ce84b7..13f160c79 100644 --- a/tests/integration/tools/atlas/atlasHelpers.ts +++ b/tests/integration/tools/atlas/atlasHelpers.ts @@ -4,7 +4,7 @@ import type { ApiClient } from "../../../../src/common/atlas/apiClient.js"; import type { IntegrationTest } from "../../helpers.js"; import { setupIntegrationTest, defaultTestConfig, defaultDriverOptions } from "../../helpers.js"; import type { SuiteCollector } from "vitest"; -import { beforeAll, describe } from "vitest"; +import { afterAll, beforeAll, describe } from "vitest"; export type IntegrationTestFunction = (integration: IntegrationTest) => void; @@ -60,6 +60,27 @@ export function withProject(integration: IntegrationTest, fn: ProjectTestFunctio } }); + afterAll(() => { + if (!projectId) { + return; + } + + const apiClient = integration.mcpServer().session.apiClient; + + // send the delete request and ignore errors + apiClient + .deleteProject({ + params: { + path: { + groupId: projectId, + }, + }, + }) + .catch((error) => { + console.log("Failed to delete project:", error); + }); + }); + const args = { getProjectId: (): string => projectId, getIpAddress: (): string => ipAddress,