Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

chore: add e2e test for backwards client ssh compatibility#8958

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
kylecarbs merged 2 commits intomainfrome2eclient
Aug 8, 2023
Merged
Show file tree
Hide file tree
Changes fromall 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
18 changes: 8 additions & 10 deletionssite/e2e/helpers.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -65,20 +65,18 @@ export const createTemplate = async (
export const sshIntoWorkspace = async (
page: Page,
workspace: string,
binaryPath = "go",
binaryArgs = ["run", coderMainPath()],
): Promise<ssh.Client> => {
const sessionToken = await findSessionToken(page)
return new Promise<ssh.Client>((resolve, reject) => {
const cp = spawn(
"go",
["run", coderMainPath(), "ssh", "--stdio", workspace],
{
env: {
...process.env,
CODER_SESSION_TOKEN: sessionToken,
CODER_URL: "http://localhost:3000",
},
const cp = spawn(binaryPath, [...binaryArgs, "ssh", "--stdio", workspace], {
env: {
...process.env,
CODER_SESSION_TOKEN: sessionToken,
CODER_URL: "http://localhost:3000",
},
)
})
cp.on("error", (err) => reject(err))
const proxyStream = new Duplex({
read: (size) => {
Expand Down
52 changes: 52 additions & 0 deletionssite/e2e/tests/outdatedCLI.spec.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
import { test } from "@playwright/test"
import { randomUUID } from "crypto"
import {
createTemplate,
createWorkspace,
downloadCoderVersion,
sshIntoWorkspace,
startAgent,
} from "../helpers"

const clientVersion = "v0.14.0"

test("ssh with client " + clientVersion, async ({ page }) => {
const token = randomUUID()
const template = await createTemplate(page, {
apply: [
{
complete: {
resources: [
{
agents: [
{
token,
},
],
},
],
},
},
],
})
const workspace = await createWorkspace(page, template)
await startAgent(page, token)
const binaryPath = await downloadCoderVersion(clientVersion)

const client = await sshIntoWorkspace(page, workspace, binaryPath)
await new Promise<void>((resolve, reject) => {
// We just exec a command to be certain the agent is running!
client.exec("exit 0", (err, stream) => {
if (err) {
return reject(err)
}
stream.on("exit", (code) => {
if (code !== 0) {
return reject(new Error(`Command exited with code ${code}`))
}
client.end()
resolve()
})
})
})
})

[8]ページ先頭

©2009-2025 Movatter.jp