Skip to content

Commit b6a6950

Browse files
Add delete deployment test
1 parent 8d22806 commit b6a6950

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
import {
2+
defaultDriverOptions,
3+
defaultTestConfig,
4+
expectDefined,
5+
getResponseElements,
6+
setupIntegrationTest,
7+
waitUntilMcpClientIsSet,
8+
} from "../../helpers.js";
9+
import { describe, expect, it } from "vitest";
10+
11+
const isMacOSInGitHubActions = process.platform === "darwin" && process.env.GITHUB_ACTIONS === "true";
12+
13+
// Docker is not available on macOS in GitHub Actions
14+
// That's why we skip the tests on macOS in GitHub Actions
15+
describe("atlas-local-delete-deployment", () => {
16+
const integration = setupIntegrationTest(
17+
() => defaultTestConfig,
18+
() => defaultDriverOptions
19+
);
20+
21+
it.skipIf(isMacOSInGitHubActions)("should have the atlas-local-delete-deployment tool", async ({ signal }) => {
22+
await waitUntilMcpClientIsSet(integration.mcpServer(), signal);
23+
24+
const { tools } = await integration.mcpClient().listTools();
25+
const deleteDeployment = tools.find((tool) => tool.name === "atlas-local-delete-deployment");
26+
expectDefined(deleteDeployment);
27+
});
28+
29+
it.skipIf(!isMacOSInGitHubActions)(
30+
"[MacOS in GitHub Actions] should not have the atlas-local-delete-deployment tool",
31+
async ({ signal }) => {
32+
// This should throw an error because the client is not set within the timeout of 5 seconds (default)
33+
await expect(waitUntilMcpClientIsSet(integration.mcpServer(), signal)).rejects.toThrow();
34+
35+
const { tools } = await integration.mcpClient().listTools();
36+
const deleteDeployment = tools.find((tool) => tool.name === "atlas-local-delete-deployment");
37+
expect(deleteDeployment).toBeUndefined();
38+
}
39+
);
40+
41+
it.skipIf(isMacOSInGitHubActions)("should have correct metadata", async ({ signal }) => {
42+
await waitUntilMcpClientIsSet(integration.mcpServer(), signal);
43+
const { tools } = await integration.mcpClient().listTools();
44+
const deleteDeployment = tools.find((tool) => tool.name === "atlas-local-delete-deployment");
45+
expectDefined(deleteDeployment);
46+
expect(deleteDeployment.inputSchema.type).toBe("object");
47+
expectDefined(deleteDeployment.inputSchema.properties);
48+
expect(deleteDeployment.inputSchema.properties).toHaveProperty("deploymentName");
49+
});
50+
51+
it.skipIf(isMacOSInGitHubActions)(
52+
"should return 'no such container' error when deployment to delete does not exist",
53+
async ({ signal }) => {
54+
await waitUntilMcpClientIsSet(integration.mcpServer(), signal);
55+
56+
const response = await integration.mcpClient().callTool({
57+
name: "atlas-local-delete-deployment",
58+
arguments: { deploymentName: "non-existent" },
59+
});
60+
const elements = getResponseElements(response.content);
61+
expect(elements.length).toBeGreaterThanOrEqual(1);
62+
expect(elements[0]?.text).toContain(
63+
"Docker responded with status code 404: No such container: non-existent"
64+
);
65+
}
66+
);
67+
});

0 commit comments

Comments
 (0)