diff --git a/hole-punch-interop/src/compose-runner.ts b/hole-punch-interop/src/compose-runner.ts index b9a090685..e37a07df3 100644 --- a/hole-punch-interop/src/compose-runner.ts +++ b/hole-punch-interop/src/compose-runner.ts @@ -34,12 +34,12 @@ export async function run(namespace: string, compose: ComposeSpecification, logD const stderrLogFile = path.join(logDir, `${sanitizedComposeName}.stderr`); try { - const { stdout, stderr } = await exec(`docker compose -f ${path.join(dir, "compose.yaml")} up --exit-code-from alice --abort-on-container-exit`, { timeout: 60 * 1000 }) + const { stdout, stderr } = await exec(`docker compose -f ${path.join(dir, "compose.yaml")} up --exit-code-from dialer --abort-on-container-exit`, { timeout: 60 * 1000 }) await fs.writeFile(stdoutLogFile, stdout); await fs.writeFile(stderrLogFile, stderr); - return JSON.parse(lastStdoutLine(stdout, "alice", sanitizedComposeName)) as Report + return JSON.parse(lastStdoutLine(stdout, "dialer", sanitizedComposeName)) as Report } catch (e: unknown) { if (isExecException(e)) { await fs.writeFile(stdoutLogFile, e.stdout) diff --git a/hole-punch-interop/src/generator.ts b/hole-punch-interop/src/generator.ts index c41f9c38b..409a7167d 100644 --- a/hole-punch-interop/src/generator.ts +++ b/hole-punch-interop/src/generator.ts @@ -47,7 +47,7 @@ export async function buildTestSpecs(versions: Array, nameFilter: strin // Generate the testing combinations by SELECT'ing from transports tables the distinct combinations where the transports of the different libp2p implementations match. const queryResults = - await db.all(`SELECT DISTINCT a.id as alice, b.id as bob, a.transport + await db.all(`SELECT DISTINCT a.id as dialer, b.id as listener, a.transport FROM transports a, transports b WHERE a.transport == b.transport;` ); @@ -55,9 +55,9 @@ export async function buildTestSpecs(versions: Array, nameFilter: strin return queryResults.map((test): ComposeSpecification => ( buildSpec(containerImages, { - name: `${test.alice} x ${test.bob} (${test.transport})`, - aliceImage: test.alice, - bobImage: test.bob, + name: `${test.dialer} x ${test.listener} (${test.transport})`, + dialerImage: test.dialer, + listenerImage: test.listener, transport: test.transport, extraEnv: buildExtraEnv(timeoutOverride, test.id1, test.id2) }, nameFilter, nameIgnore, routerImageId, relayImageId, routerDelay, relayDelay) @@ -66,16 +66,16 @@ export async function buildTestSpecs(versions: Array, nameFilter: strin interface TestSpec { name: string, - aliceImage: string, - bobImage: string, + dialerImage: string, + listenerImage: string, transport: string, extraEnv?: { [key: string]: string } } function buildSpec(containerImages: { [key: string]: () => string }, { name, - aliceImage, - bobImage, + dialerImage, + listenerImage, transport, extraEnv }: TestSpec, nameFilter: string | null, nameIgnore: string | null, routerImageId: string, relayImageId: string, routerDelay: number, relayDelay: number): ComposeSpecification | null { @@ -89,7 +89,7 @@ function buildSpec(containerImages: { [key: string]: () => string }, { const rustLog = "debug,netlink_proto=warn,rustls=warn,multistream_select=warn"; let internetNetworkName = `${sanitizeComposeName(name)}_internet` - let startupScriptFn = (actor: "alice" | "bob") => (` + let startupScriptFn = (actor: "dialer" | "listener") => (` set -ex; # Wait for router to be online @@ -132,7 +132,7 @@ function buildSpec(containerImages: { [key: string]: () => string }, { }, cap_add: ["NET_ADMIN"] }, - alice_router: { + dialer_router: { depends_on: ["redis"], image: routerImageId, init: true, @@ -140,28 +140,28 @@ function buildSpec(containerImages: { [key: string]: () => string }, { DELAY_MS: routerDelay }, networks: { - alice_lan: {}, + dialer_lan: {}, internet: {}, }, cap_add: ["NET_ADMIN"] }, - alice: { - depends_on: ["relay", "alice_router", "redis"], - image: containerImages[aliceImage](), + dialer: { + depends_on: ["relay", "dialer_router", "redis"], + image: containerImages[dialerImage](), init: true, - command: ["/bin/sh", "-c", startupScriptFn("alice")], + command: ["/bin/sh", "-c", startupScriptFn("dialer")], environment: { TRANSPORT: transport, MODE: "dial", RUST_LOG: rustLog, }, networks: { - alice_lan: {}, + dialer_lan: {}, }, cap_add: ["NET_ADMIN"], volumes: [dockerSocketVolume] }, - bob_router: { + listener_router: { depends_on: ["redis"], image: routerImageId, init: true, @@ -169,23 +169,23 @@ function buildSpec(containerImages: { [key: string]: () => string }, { DELAY_MS: routerDelay }, networks: { - bob_lan: {}, + listener_lan: {}, internet: {}, }, cap_add: ["NET_ADMIN"] }, - bob: { - depends_on: ["relay", "bob_router", "redis"], - image: containerImages[bobImage](), + listener: { + depends_on: ["relay", "listener_router", "redis"], + image: containerImages[listenerImage](), init: true, - command: ["/bin/sh", "-c", startupScriptFn("bob")], + command: ["/bin/sh", "-c", startupScriptFn("listener")], environment: { TRANSPORT: transport, MODE: "listen", RUST_LOG: rustLog, }, networks: { - bob_lan: {}, + listener_lan: {}, }, cap_add: ["NET_ADMIN"], volumes: [dockerSocketVolume] @@ -199,18 +199,18 @@ function buildSpec(containerImages: { [key: string]: () => string }, { internet: { aliases: ["redis"] }, - alice_lan: { + dialer_lan: { aliases: ["redis"] }, - bob_lan: { + listener_lan: { aliases: ["redis"] }, } } }, networks: { - alice_lan: { }, - bob_lan: { }, + dialer_lan: { }, + listener_lan: { }, internet: { }, } } diff --git a/hole-punch-interop/src/stdoutParser.test.ts b/hole-punch-interop/src/stdoutParser.test.ts index 2a6eef4fd..3b79fd815 100644 --- a/hole-punch-interop/src/stdoutParser.test.ts +++ b/hole-punch-interop/src/stdoutParser.test.ts @@ -1,7 +1,7 @@ import {lastStdoutLine} from "./compose-runner"; let exampleStdout = ` -Attaching to rust-v0_52_x_rust-v0_52__quic_-alice-1, rust-v0_52_x_rust-v0_52__quic_-alice_router-1, rust-v0_52_x_rust-v0_52__quic_-bob-1, rust-v0_52_x_rust-v0_52__quic_-bob_router-1, rust-v0_52_x_rust-v0_52__quic_-redis-1, rust-v0_52_x_rust-v0_52__quic_-relay-1 +Attaching to rust-v0_52_x_rust-v0_52__quic_-dialer-1, rust-v0_52_x_rust-v0_52__quic_-dialer_router-1, rust-v0_52_x_rust-v0_52__quic_-listener-1, rust-v0_52_x_rust-v0_52__quic_-listener_router-1, rust-v0_52_x_rust-v0_52__quic_-redis-1, rust-v0_52_x_rust-v0_52__quic_-relay-1 rust-v0_52_x_rust-v0_52__quic_-redis-1 | 1:C 19 Sep 2023 05:19:20.620 # WARNING Memory overcommit must be enabled! Without it, a background save or replication may fail under low memory condition. Being disabled, it can also cause failures without low memory condition, see https://github.com/jemalloc/jemalloc/issues/1328. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect. rust-v0_52_x_rust-v0_52__quic_-redis-1 | 1:C 19 Sep 2023 05:19:20.620 * oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo rust-v0_52_x_rust-v0_52__quic_-redis-1 | 1:C 19 Sep 2023 05:19:20.620 * Redis version=7.2.1, bits=64, commit=00000000, modified=0, pid=1, just started @@ -10,11 +10,11 @@ rust-v0_52_x_rust-v0_52__quic_-redis-1 | 1:M 19 Sep 2023 05:19:20.620 * rust-v0_52_x_rust-v0_52__quic_-redis-1 | 1:M 19 Sep 2023 05:19:20.621 * Running mode=standalone, port=6379. rust-v0_52_x_rust-v0_52__quic_-redis-1 | 1:M 19 Sep 2023 05:19:20.621 * Server initialized rust-v0_52_x_rust-v0_52__quic_-redis-1 | 1:M 19 Sep 2023 05:19:20.621 * Ready to accept connections tcp -rust-v0_52_x_rust-v0_52__quic_-alice-1 | {"rtt_to_holepunched_peer_millis":201} -rust-v0_52_x_rust-v0_52__quic_-alice-1 exited with code 0 +rust-v0_52_x_rust-v0_52__quic_-dialer-1 | {"rtt_to_holepunched_peer_millis":201} +rust-v0_52_x_rust-v0_52__quic_-dialer-1 exited with code 0 `; -const line = lastStdoutLine(exampleStdout, "alice", "rust-v0_52_x_rust-v0_52__quic_"); +const line = lastStdoutLine(exampleStdout, "dialer", "rust-v0_52_x_rust-v0_52__quic_"); if (line != `{"rtt_to_holepunched_peer_millis":201}`) { throw new Error("Unexpected stdout")