Skip to content

Commit 4d3230c

Browse files
authored
fix: default to executing e2e ssh without args (#8975)
This was causing the test to fail consistently!
1 parent c20c4fa commit 4d3230c

File tree

1 file changed

+34
-22
lines changed

1 file changed

+34
-22
lines changed

site/e2e/helpers.ts

+34-22
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,11 @@ export const sshIntoWorkspace = async (
6666
page: Page,
6767
workspace: string,
6868
binaryPath = "go",
69-
binaryArgs = ["run", coderMainPath()],
69+
binaryArgs: string[] = [],
7070
): Promise<ssh.Client> => {
71+
if (binaryPath === "go") {
72+
binaryArgs = ["run", coderMainPath()]
73+
}
7174
const sessionToken = await findSessionToken(page)
7275
return new Promise<ssh.Client>((resolve, reject) => {
7376
const cp = spawn(binaryPath, [...binaryArgs, "ssh", "--stdio", workspace], {
@@ -120,7 +123,7 @@ export const downloadCoderVersion = async (
120123
}
121124

122125
const binaryName = "coder-e2e-" + version
123-
const tempDir = "/tmp"
126+
const tempDir = "/tmp/coder-e2e-cache"
124127
// The install script adds `./bin` automatically to the path :shrug:
125128
const binaryPath = path.join(tempDir, "bin", binaryName)
126129

@@ -138,26 +141,35 @@ export const downloadCoderVersion = async (
138141
// Runs our public install script using our options to
139142
// install the binary!
140143
await new Promise<void>((resolve, reject) => {
141-
const cp = spawn("sh", [
142-
"-c",
144+
const cp = spawn(
145+
"sh",
143146
[
144-
"curl",
145-
"-L",
146-
"https://coder.com/install.sh",
147-
"|",
148-
"sh",
149-
"-s",
150-
"--",
151-
"--version",
152-
version,
153-
"--method",
154-
"standalone",
155-
"--prefix",
156-
tempDir,
157-
"--binary-name",
158-
binaryName,
159-
].join(" "),
160-
])
147+
"-c",
148+
[
149+
"curl",
150+
"-L",
151+
"https://coder.com/install.sh",
152+
"|",
153+
"sh",
154+
"-s",
155+
"--",
156+
"--version",
157+
version,
158+
"--method",
159+
"standalone",
160+
"--prefix",
161+
tempDir,
162+
"--binary-name",
163+
binaryName,
164+
].join(" "),
165+
],
166+
{
167+
env: {
168+
...process.env,
169+
XDG_CACHE_HOME: "/tmp/coder-e2e-cache",
170+
},
171+
},
172+
)
161173
// eslint-disable-next-line no-console -- Needed for debugging
162174
cp.stderr.on("data", (data) => console.log(data.toString()))
163175
cp.on("close", (code) => {
@@ -189,7 +201,7 @@ export const startAgentWithCommand = async (
189201
buffer = Buffer.concat([buffer, data])
190202
})
191203
try {
192-
await page.getByTestId("agent-status-ready").isVisible()
204+
await page.getByTestId("agent-status-ready").waitFor({ state: "visible" })
193205
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- The error is a string
194206
} catch (ex: any) {
195207
throw new Error(ex.toString() + "\n" + buffer.toString())

0 commit comments

Comments
 (0)