Skip to content

Commit 61df0df

Browse files
committed
fix: styles
1 parent a1fcd65 commit 61df0df

File tree

4 files changed

+15
-12
lines changed

4 files changed

+15
-12
lines changed

src/common/utils.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export function sleep(ms: number) {
2+
return new Promise((resolve) => setTimeout(resolve, ms));
3+
}

src/tools/atlas/metadata/connectCluster.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { z } from "zod";
22
import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
33
import { AtlasToolBase } from "../atlasTool.js";
44
import { ToolArgs, OperationType } from "../../tool.js";
5+
import { sleep } from "../../../common/utils.js";
56

67
function generateSecurePassword(): string {
78
// TODO: use a better password generator
@@ -67,13 +68,13 @@ export class ConnectClusterTool extends AtlasToolBase {
6768
},
6869
});
6970

70-
setTimeout(async () => {
71+
void sleep(expiryMs).then(async () => {
7172
// disconnect after 12 hours
7273
if (this.session.serviceProvider) {
73-
await this.session.serviceProvider?.close(true);
74+
await this.session.serviceProvider.close(true);
7475
this.session.serviceProvider = undefined;
7576
}
76-
}, expiryMs);
77+
});
7778

7879
const connectionString =
7980
(cluster.connectionStrings.standardSrv || cluster.connectionStrings.standard || "").replace(

tests/integration/tools/atlas/atlasHelpers.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ import { setupIntegrationTest, IntegrationTest } from "../../helpers.js";
55

66
export type IntegrationTestFunction = (integration: IntegrationTest) => void;
77

8-
export function sleep(ms: number) {
9-
return new Promise((resolve) => setTimeout(resolve, ms));
10-
}
11-
128
export function describeWithAtlas(name: string, fn: IntegrationTestFunction) {
139
const testDefinition = () => {
1410
const integration = setupIntegrationTest();

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { Session } from "../../../../src/session.js";
22
import { expectDefined } from "../../helpers.js";
3-
import { describeWithAtlas, withProject, sleep, randomId } from "./atlasHelpers.js";
3+
import { describeWithAtlas, withProject, randomId } from "./atlasHelpers.js";
44
import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
5+
import { sleep } from "../../../../src/common/utils.js";
56

67
async function deleteAndWaitCluster(session: Session, projectId: string, clusterName: string) {
78
await session.apiClient.deleteCluster({
@@ -145,10 +146,12 @@ describeWithAtlas("clusters", (integration) => {
145146
groupId: projectId,
146147
},
147148
},
148-
body: [{
149-
comment: "MCP test",
150-
cidrBlock: "0.0.0.0/0"
151-
}]
149+
body: [
150+
{
151+
comment: "MCP test",
152+
cidrBlock: "0.0.0.0/0",
153+
},
154+
],
152155
});
153156
});
154157

0 commit comments

Comments
 (0)