Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 3 additions & 1 deletion 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 coderPort = process.env.CODER_E2E_PORT
? Number(process.env.CODER_E2E_PORT)
: 3111;
export const prometheusPort = 2114;

// Use alternate ports in case we're running in a Coder Workspace.
Expand Down
9 changes: 4 additions & 5 deletions site/e2e/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ import type {
UpdateTemplateMeta,
} from "api/typesGenerated";
import { TarWriter } from "utils/tar";
import { prometheusPort, agentPProfPort } from "./constants";
import { port } from "./playwright.config";
import { agentPProfPort, coderPort, prometheusPort } from "./constants";
import {
Agent,
type App,
Expand Down Expand Up @@ -156,7 +155,7 @@ export const sshIntoWorkspace = async (
env: {
...process.env,
CODER_SESSION_TOKEN: sessionToken,
CODER_URL: "http://localhost:3000",
CODER_URL: `http://localhost:${coderPort}`,
},
});
cp.on("error", (err) => reject(err));
Expand Down Expand Up @@ -304,7 +303,7 @@ export const startAgentWithCommand = async (
const cp = spawn(command, [...args, "agent", "--no-reap"], {
env: {
...process.env,
CODER_AGENT_URL: "http://localhost:" + port,
CODER_AGENT_URL: `http://localhost:${coderPort}`,
CODER_AGENT_TOKEN: token,
CODER_AGENT_PPROF_ADDRESS: "127.0.0.1:" + agentPProfPort,
CODER_AGENT_PROMETHEUS_ADDRESS: "127.0.0.1:" + prometheusPort,
Expand Down Expand Up @@ -701,7 +700,7 @@ export const updateTemplate = async (
env: {
...process.env,
CODER_SESSION_TOKEN: sessionToken,
CODER_URL: "http://localhost:3000",
CODER_URL: `http://localhost:${coderPort}`,
},
},
);
Expand Down
14 changes: 5 additions & 9 deletions site/e2e/playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import { defineConfig } from "@playwright/test";
import path from "path";
import { defaultPort, coderdPProfPort, gitAuth } from "./constants";

export const port = process.env.CODER_E2E_PORT
? Number(process.env.CODER_E2E_PORT)
: defaultPort;
import { coderPort, coderdPProfPort, gitAuth } from "./constants";

export const wsEndpoint = process.env.CODER_E2E_WS_ENDPOINT;

Expand Down Expand Up @@ -35,7 +31,7 @@ export default defineConfig({
],
reporter: [["./reporter.ts"]],
use: {
baseURL: `http://localhost:${port}`,
baseURL: `http://localhost:${coderPort}`,
video: "retain-on-failure",
...(wsEndpoint
? {
Expand All @@ -50,12 +46,12 @@ export default defineConfig({
}),
},
webServer: {
url: `http://localhost:${port}/api/v2/deployment/config`,
url: `http://localhost:${coderPort}/api/v2/deployment/config`,
command:
`go run -tags embed ${coderMain} server ` +
`--global-config $(mktemp -d -t e2e-XXXXXXXXXX) ` +
`--access-url=http://localhost:${port} ` +
`--http-address=localhost:${port} ` +
`--access-url=http://localhost:${coderPort} ` +
`--http-address=localhost:${coderPort} ` +
`--in-memory --telemetry=false ` +
`--dangerous-disable-rate-limits ` +
`--provisioner-daemons 10 ` +
Expand Down
3 changes: 2 additions & 1 deletion site/e2e/reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import type {
import axios from "axios";
import * as fs from "fs/promises";
import type { Writable } from "stream";
import { coderdPProfPort } from "./constants";

class CoderReporter implements Reporter {
config: FullConfig | null = null;
Expand Down Expand Up @@ -119,7 +120,7 @@ const filteredServerLogLines = (chunk: string): string[] =>

const exportDebugPprof = async (outputFile: string) => {
const response = await axios.get(
"http://127.0.0.1:6062/debug/pprof/goroutine?debug=1",
`http://127.0.0.1:${coderdPProfPort}/debug/pprof/goroutine?debug=1`,
);
if (response.status !== 200) {
throw new Error(`Error: Received status code ${response.status}`);
Expand Down