Skip to content

Commit

Permalink
Implementing review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
Frederik Rothenberger committed Nov 10, 2022
1 parent fe783ac commit b24af14
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 16 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/canister-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -486,13 +486,14 @@ jobs:
# Copy example to make sure it does not rely on living inside the II repo
builddir=$(mktemp -d)
cp -r ./demos/using-dev-build/. "$builddir"
ii_wasm="$PWD/internet_identity_dev.wasm"
ii_did="$PWD/src/internet_identity/internet_identity.did"
pushd "$builddir"
# Install npm deps
npm ci
ii_wasm="$GITHUB_WORKSPACE"/internet_identity_dev.wasm
ii_did="$GITHUB_WORKSPACE"/src/internet_identity/internet_identity.did
sed -i "s;https://github.com/dfinity/internet-identity/releases/latest/download/internet_identity_dev.wasm;$ii_wasm;" ./dfx.json
sed -i "s;https://github.com/dfinity/internet-identity/releases/latest/download/internet_identity.did;$ii_did;" ./dfx.json
Expand Down
19 changes: 6 additions & 13 deletions demos/using-dev-build/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import * as fs from "fs";
import { ChildProcess, spawn } from "child_process";
import { ChildProcess, spawn, execSync } from "child_process";

// Port and URL for II and the sign in app, then exported to the tests
const II_DAPP_PORT = 8086;
Expand Down Expand Up @@ -57,16 +57,9 @@ function parseCanisterIDs(): CanisterIDs {
}
}

async function getReplicaHost(): Promise<string> {
let proc = spawn("dfx", ["info", "webserver-port"]);
let result = "";
proc.stdout.on("data", (data) => (result += data.toString()));
return new Promise((resolve) =>
proc.stdout.on("close", (code) => {
console.log("process exited with exit code " + code);
resolve(`http://localhost:${result}`);
})
);
function getReplicaHost(): string {
let port = execSync("dfx info webserver-port");
return `http://localhost:${port}`;
}

/*
Expand All @@ -89,14 +82,14 @@ function spawnProxy(
]);
}

async function main() {
function main() {
// Read values and spawn proxy
const canisterIds = parseCanisterIDs();
console.log(
`Using canister IDs: internet_identity: ${canisterIds.internetIdentity}, webapp: ${canisterIds.webapp}`
);

const replicaHost = await getReplicaHost();
const replicaHost = getReplicaHost();
console.log(`Using replica host: ${replicaHost}`);

const proxy = spawnProxy(canisterIds, replicaHost);
Expand Down

0 comments on commit b24af14

Please sign in to comment.