Skip to content

Commit ba7dcbe

Browse files
committed
chore: stop waiting for cluster deletion (#607)
1 parent 0d92d0f commit ba7dcbe

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
@@ -71,18 +71,25 @@ export function withProject(integration: IntegrationTest, fn: ProjectTestFunctio
7171
}
7272
});
7373

74-
afterAll(async () => {
74+
afterAll(() => {
75+
if (!projectId) {
76+
return;
77+
}
78+
7579
const apiClient = integration.mcpServer().session.apiClient;
76-
if (projectId) {
77-
// projectId may be empty if beforeAll failed.
78-
await apiClient.deleteProject({
80+
81+
// send the delete request and ignore errors
82+
apiClient
83+
.deleteProject({
7984
params: {
8085
path: {
8186
groupId: projectId,
8287
},
8388
},
89+
})
90+
.catch((error) => {
91+
console.log("Failed to delete project:", error);
8492
});
85-
}
8693
});
8794

8895
const args = {

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

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

19-
async function deleteAndWaitCluster(session: Session, projectId: string, clusterName: string): Promise<void> {
19+
async function deleteCluster(
20+
session: Session,
21+
projectId: string,
22+
clusterName: string,
23+
wait: boolean = false
24+
): Promise<void> {
2025
await session.apiClient.deleteCluster({
2126
params: {
2227
path: {
@@ -25,6 +30,11 @@ async function deleteAndWaitCluster(session: Session, projectId: string, cluster
2530
},
2631
},
2732
});
33+
34+
if (!wait) {
35+
return;
36+
}
37+
2838
while (true) {
2939
try {
3040
await session.apiClient.getCluster({
@@ -85,7 +95,7 @@ describeWithAtlas("clusters", (integration) => {
8595
const projectId = getProjectId();
8696
if (projectId) {
8797
const session: Session = integration.mcpServer().session;
88-
await deleteAndWaitCluster(session, projectId, clusterName);
98+
await deleteCluster(session, projectId, clusterName);
8999
}
90100
});
91101

0 commit comments

Comments
 (0)