Skip to content

Commit 1d33b4b

Browse files
authored
chore: stop waiting for cluster deletion (#607)
1 parent 4cd078d commit 1d33b4b

File tree

2 files changed

+24
-7
lines changed

2 files changed

+24
-7
lines changed

tests/integration/tools/atlas/atlasHelpers.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,18 +60,25 @@ export function withProject(integration: IntegrationTest, fn: ProjectTestFunctio
6060
}
6161
});
6262

63-
afterAll(async () => {
63+
afterAll(() => {
64+
if (!projectId) {
65+
return;
66+
}
67+
6468
const apiClient = integration.mcpServer().session.apiClient;
65-
if (projectId) {
66-
// projectId may be empty if beforeAll failed.
67-
await apiClient.deleteProject({
69+
70+
// send the delete request and ignore errors
71+
apiClient
72+
.deleteProject({
6873
params: {
6974
path: {
7075
groupId: projectId,
7176
},
7277
},
78+
})
79+
.catch((error) => {
80+
console.log("Failed to delete project:", error);
7381
});
74-
}
7582
});
7683

7784
const args = {

tests/integration/tools/atlas/clusters.test.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@ function sleep(ms: number): Promise<void> {
88
return new Promise((resolve) => setTimeout(resolve, ms));
99
}
1010

11-
async function deleteAndWaitCluster(session: Session, projectId: string, clusterName: string): Promise<void> {
11+
async function deleteCluster(
12+
session: Session,
13+
projectId: string,
14+
clusterName: string,
15+
wait: boolean = false
16+
): Promise<void> {
1217
await session.apiClient.deleteCluster({
1318
params: {
1419
path: {
@@ -17,6 +22,11 @@ async function deleteAndWaitCluster(session: Session, projectId: string, cluster
1722
},
1823
},
1924
});
25+
26+
if (!wait) {
27+
return;
28+
}
29+
2030
while (true) {
2131
try {
2232
await session.apiClient.getCluster({
@@ -64,7 +74,7 @@ describeWithAtlas("clusters", (integration) => {
6474
const projectId = getProjectId();
6575
if (projectId) {
6676
const session: Session = integration.mcpServer().session;
67-
await deleteAndWaitCluster(session, projectId, clusterName);
77+
await deleteCluster(session, projectId, clusterName);
6878
}
6979
});
7080

0 commit comments

Comments
 (0)