Skip to content

test: improve E2E framework #9469

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 11 commits into from
Sep 4, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Constants
  • Loading branch information
mtojek committed Sep 4, 2023
commit e81432f35fe0659d69eadb9f571649b055b485dc
2 changes: 2 additions & 0 deletions site/e2e/constants.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Default port from the server
export const defaultPort = 3000
export const prometheusPort = 2114
export const pprofPort = 6061

// Credentials for the first user
export const username = "admin"
Expand Down
7 changes: 4 additions & 3 deletions site/e2e/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
Resource,
RichParameter,
} from "./provisionerGenerated"
import { prometheusPort, pprofPort } from "./constants"
import { port } from "./playwright.config"
import * as ssh from "ssh2"
import { Duplex } from "stream"
Expand Down Expand Up @@ -318,8 +319,8 @@ export const startAgentWithCommand = async (
...process.env,
CODER_AGENT_URL: "http://localhost:" + port,
CODER_AGENT_TOKEN: token,
CODER_AGENT_PPROF_ADDRESS: "127.0.0.1:6061",
CODER_AGENT_PROMETHEUS_ADDRESS: "127.0.0.1:2114",
CODER_AGENT_PPROF_ADDRESS: "127.0.0.1:" + pprofPort,
CODER_AGENT_PROMETHEUS_ADDRESS: "127.0.0.1:" + prometheusPort,
},
})
cp.stdout.on("data", (data: Buffer) => {
Expand All @@ -345,7 +346,7 @@ export const stopAgent = async (cp: ChildProcess, goRun: boolean = true) => {
throw new Error(`exec error: ${JSON.stringify(error)}`)
}
})
await waitUntilUrlIsNotResponding("http://127.0.0.1:2114")
await waitUntilUrlIsNotResponding("http://localhost:" + prometheusPort)
}

const waitUntilUrlIsNotResponding = async (url: string) => {
Expand Down