Skip to content

fix: default to executing e2e ssh without args #8975

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 34 additions & 22 deletions site/e2e/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,11 @@ export const sshIntoWorkspace = async (
page: Page,
workspace: string,
binaryPath = "go",
binaryArgs = ["run", coderMainPath()],
binaryArgs: string[] = [],
): Promise<ssh.Client> => {
if (binaryPath === "go") {
binaryArgs = ["run", coderMainPath()]
}
const sessionToken = await findSessionToken(page)
return new Promise<ssh.Client>((resolve, reject) => {
const cp = spawn(binaryPath, [...binaryArgs, "ssh", "--stdio", workspace], {
Expand Down Expand Up @@ -120,7 +123,7 @@ export const downloadCoderVersion = async (
}

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

Expand All @@ -138,26 +141,35 @@ export const downloadCoderVersion = async (
// Runs our public install script using our options to
// install the binary!
await new Promise<void>((resolve, reject) => {
const cp = spawn("sh", [
"-c",
const cp = spawn(
"sh",
[
"curl",
"-L",
"https://coder.com/install.sh",
"|",
"sh",
"-s",
"--",
"--version",
version,
"--method",
"standalone",
"--prefix",
tempDir,
"--binary-name",
binaryName,
].join(" "),
])
"-c",
[
"curl",
"-L",
"https://coder.com/install.sh",
"|",
"sh",
"-s",
"--",
"--version",
version,
"--method",
"standalone",
"--prefix",
tempDir,
"--binary-name",
binaryName,
].join(" "),
],
{
env: {
...process.env,
XDG_CACHE_HOME: "/tmp/coder-e2e-cache",
},
},
)
// eslint-disable-next-line no-console -- Needed for debugging
cp.stderr.on("data", (data) => console.log(data.toString()))
cp.on("close", (code) => {
Expand Down Expand Up @@ -189,7 +201,7 @@ export const startAgentWithCommand = async (
buffer = Buffer.concat([buffer, data])
})
try {
await page.getByTestId("agent-status-ready").isVisible()
await page.getByTestId("agent-status-ready").waitFor({ state: "visible" })
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- The error is a string
} catch (ex: any) {
throw new Error(ex.toString() + "\n" + buffer.toString())
Expand Down