Skip to content

Commit fffe83a

Browse files
committed
stop workspaces
1 parent f301c09 commit fffe83a

File tree

3 files changed

+19
-6
lines changed

3 files changed

+19
-6
lines changed

site/e2e/tests/app.spec.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
import { test } from "@playwright/test"
22
import { randomUUID } from "crypto"
33
import * as http from "http"
4-
import { createTemplate, createWorkspace, startAgent } from "../helpers"
4+
import {
5+
createTemplate,
6+
createWorkspace,
7+
startAgent,
8+
stopWorkspace,
9+
} from "../helpers"
510
import { beforeCoderTest } from "../hooks"
611

712
test.beforeEach(async ({ page }) => await beforeCoderTest(page))
@@ -43,7 +48,7 @@ test("app", async ({ context, page }) => {
4348
},
4449
],
4550
})
46-
await createWorkspace(page, template)
51+
const workspaceName = await createWorkspace(page, template)
4752
await startAgent(page, token)
4853

4954
// Wait for the web terminal to open in a new tab
@@ -52,4 +57,6 @@ test("app", async ({ context, page }) => {
5257
const app = await pagePromise
5358
await app.waitForLoadState("domcontentloaded")
5459
await app.getByText(appContent).isVisible()
60+
61+
await stopWorkspace(page, workspaceName)
5562
})

site/e2e/tests/outdatedAgent.spec.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
downloadCoderVersion,
77
sshIntoWorkspace,
88
startAgentWithCommand,
9+
stopWorkspace,
910
} from "../helpers"
1011
import { beforeCoderTest } from "../hooks"
1112

@@ -32,11 +33,11 @@ test("ssh with agent " + agentVersion, async ({ page }) => {
3233
},
3334
],
3435
})
35-
const workspace = await createWorkspace(page, template)
36+
const workspaceName = await createWorkspace(page, template)
3637
const binaryPath = await downloadCoderVersion(agentVersion)
3738
await startAgentWithCommand(page, token, binaryPath)
3839

39-
const client = await sshIntoWorkspace(page, workspace)
40+
const client = await sshIntoWorkspace(page, workspaceName)
4041
await new Promise<void>((resolve, reject) => {
4142
// We just exec a command to be certain the agent is running!
4243
client.exec("exit 0", (err, stream) => {
@@ -52,4 +53,6 @@ test("ssh with agent " + agentVersion, async ({ page }) => {
5253
})
5354
})
5455
})
56+
57+
await stopWorkspace(page, workspaceName)
5558
})

site/e2e/tests/outdatedCLI.spec.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
downloadCoderVersion,
77
sshIntoWorkspace,
88
startAgent,
9+
stopWorkspace,
910
} from "../helpers"
1011
import { beforeCoderTest } from "../hooks"
1112

@@ -32,11 +33,11 @@ test("ssh with client " + clientVersion, async ({ page }) => {
3233
},
3334
],
3435
})
35-
const workspace = await createWorkspace(page, template)
36+
const workspaceName = await createWorkspace(page, template)
3637
await startAgent(page, token)
3738
const binaryPath = await downloadCoderVersion(clientVersion)
3839

39-
const client = await sshIntoWorkspace(page, workspace, binaryPath)
40+
const client = await sshIntoWorkspace(page, workspaceName, binaryPath)
4041
await new Promise<void>((resolve, reject) => {
4142
// We just exec a command to be certain the agent is running!
4243
client.exec("exit 0", (err, stream) => {
@@ -52,4 +53,6 @@ test("ssh with client " + clientVersion, async ({ page }) => {
5253
})
5354
})
5455
})
56+
57+
await stopWorkspace(page, workspaceName)
5558
})

0 commit comments

Comments
 (0)