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
11 changes: 9 additions & 2 deletions automation/run-e2e/lib/ci.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import c from "ansi-colors";
import findFreePort from "find-free-port";
import nodeIp from "ip";
import { execSync } from "node:child_process";
import { createServer } from "node:net";
import { networkInterfaces } from "node:os";
import { fileURLToPath } from "node:url";
import p from "node:path";
import sh from "shelljs";
Expand Down Expand Up @@ -34,6 +34,13 @@ const HOST_NETWORK = ["1", "true"].includes(String(process.env.E2E_HOST_NETWORK)
const HOST_NETWORK_RUNTIME_PORT = 8080;
const HOST_NETWORK_ADMIN_PORT = 8090;

// First external IPv4 address of this machine, so containers can reach the host.
function getHostIpAddress() {
return Object.values(networkInterfaces())
.flat()
.find(iface => iface?.family === "IPv4" && !iface.internal)?.address;
}

export async function ci() {
console.log(c.cyan("Run e2e tests in CI environment"));

Expand Down Expand Up @@ -64,7 +71,7 @@ export async function ci() {
ip = "127.0.0.1";
} else {
freePort = await findFreePort(3000);
ip = nodeIp.address();
ip = getHostIpAddress();
}

if (!ip) {
Expand Down
1 change: 0 additions & 1 deletion automation/run-e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
"cross-zip": "^4.0.1",
"enquirer": "^2.4.1",
"find-free-port": "^2.0.0",
"ip": "^2.0.1",
"node-fetch": "^3.3.2",
"shelljs": "^0.10.0",
"yargs-parser": "^22.0.0"
Expand Down
8 changes: 0 additions & 8 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading