Skip to content

Commit a9edff3

Browse files
committed
Ignore 404 errors
1 parent 5d14a16 commit a9edff3

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

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

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
22
import { Session } from "../../../../src/session.js";
33
import { describeWithAtlas, withProject, randomId } from "./atlasHelpers.js";
44
import { expectDefined, getResponseElements } from "../../helpers.js";
5+
import { ApiClientError } from "../../../../src/common/atlas/apiClientError.js";
56

67
describeWithAtlas("db users", (integration) => {
78
withProject(integration, ({ getProjectId }) => {
@@ -28,18 +29,22 @@ describeWithAtlas("db users", (integration) => {
2829
};
2930

3031
afterEach(async () => {
31-
const projectId = getProjectId();
32-
33-
const session: Session = integration.mcpServer().session;
34-
await session.apiClient.deleteDatabaseUser({
35-
params: {
36-
path: {
37-
groupId: projectId,
38-
username: userName,
39-
databaseName: "admin",
32+
try {
33+
await integration.mcpServer().session.apiClient.deleteDatabaseUser({
34+
params: {
35+
path: {
36+
groupId: getProjectId(),
37+
username: userName,
38+
databaseName: "admin",
39+
},
4040
},
41-
},
42-
});
41+
});
42+
} catch (error) {
43+
// Ignore 404 errors when deleting the user
44+
if (!(error instanceof ApiClientError) || error.response?.status !== 404) {
45+
throw error;
46+
}
47+
}
4348
});
4449

4550
describe("atlas-create-db-user", () => {

0 commit comments

Comments
 (0)