diff --git a/tests/integration/tools/atlas/atlasHelpers.ts b/tests/integration/tools/atlas/atlasHelpers.ts index 00ac53feb..13f160c79 100644 --- a/tests/integration/tools/atlas/atlasHelpers.ts +++ b/tests/integration/tools/atlas/atlasHelpers.ts @@ -60,18 +60,25 @@ export function withProject(integration: IntegrationTest, fn: ProjectTestFunctio } }); - afterAll(async () => { + afterAll(() => { + if (!projectId) { + return; + } + const apiClient = integration.mcpServer().session.apiClient; - if (projectId) { - // projectId may be empty if beforeAll failed. - await apiClient.deleteProject({ + + // send the delete request and ignore errors + apiClient + .deleteProject({ params: { path: { groupId: projectId, }, }, + }) + .catch((error) => { + console.log("Failed to delete project:", error); }); - } }); const args = { diff --git a/tests/integration/tools/atlas/clusters.test.ts b/tests/integration/tools/atlas/clusters.test.ts index 5c50c570c..0e666be7d 100644 --- a/tests/integration/tools/atlas/clusters.test.ts +++ b/tests/integration/tools/atlas/clusters.test.ts @@ -8,7 +8,12 @@ function sleep(ms: number): Promise { return new Promise((resolve) => setTimeout(resolve, ms)); } -async function deleteAndWaitCluster(session: Session, projectId: string, clusterName: string): Promise { +async function deleteCluster( + session: Session, + projectId: string, + clusterName: string, + wait: boolean = false +): Promise { await session.apiClient.deleteCluster({ params: { path: { @@ -17,6 +22,11 @@ async function deleteAndWaitCluster(session: Session, projectId: string, cluster }, }, }); + + if (!wait) { + return; + } + while (true) { try { await session.apiClient.getCluster({ @@ -64,7 +74,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); } });