From e4f65ceca8744a99c9002dae5580c80007079c94 Mon Sep 17 00:00:00 2001 From: Luqi Pan Date: Fri, 26 Jan 2024 13:50:32 -0800 Subject: [PATCH 01/15] feat(integration-test): use dapp-offer-up as target for getting-started test --- packages/agoric-cli/tools/getting-started.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/packages/agoric-cli/tools/getting-started.js b/packages/agoric-cli/tools/getting-started.js index 40ceae5f278..5a80be36690 100644 --- a/packages/agoric-cli/tools/getting-started.js +++ b/packages/agoric-cli/tools/getting-started.js @@ -105,13 +105,7 @@ export const gettingStartedWorkflowTest = async (t, options = {}) => { initOptions.push(...opts); } t.is( - await myMain([ - 'init', - '--dapp-template', - 'dapp-fungible-faucet', - ...initOptions, - 'dapp-foo', - ]), + await myMain(['init', ...initOptions, 'dapp-foo']), 0, 'init dapp-foo works', ); From 8f19adaaf2247ae8ae27df314add8010522c745b Mon Sep 17 00:00:00 2001 From: Luqi Pan Date: Fri, 26 Jan 2024 14:25:10 -0800 Subject: [PATCH 02/15] fix(integration-test): bump node version from 16.x to 18.x --- .github/workflows/integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 67efddfcc81..193f028edd7 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -57,7 +57,7 @@ jobs: # Prerequisites - uses: ./.github/actions/restore-node with: - node-version: 16.x + node-version: 18.x keep-endo: 'true' # Select a branch on dapp to test against by adding text to the body of the From a03392605a37f87b1772493daa73f16d0268556b Mon Sep 17 00:00:00 2001 From: Luqi Pan Date: Fri, 26 Jan 2024 14:45:08 -0800 Subject: [PATCH 03/15] debug(integration-test): try node-version 18.18 --- .github/workflows/integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 193f028edd7..05a8e4eaabf 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -57,7 +57,7 @@ jobs: # Prerequisites - uses: ./.github/actions/restore-node with: - node-version: 18.x + node-version: 18.18 keep-endo: 'true' # Select a branch on dapp to test against by adding text to the body of the From a573b6fe431473a8cb4ef471ac4e002b8bae0a32 Mon Sep 17 00:00:00 2001 From: Luqi Pan Date: Fri, 26 Jan 2024 15:19:01 -0800 Subject: [PATCH 04/15] debug(integration-test): comment out tests related to agoric deploy --- packages/agoric-cli/tools/getting-started.js | 58 ++++++++++---------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/packages/agoric-cli/tools/getting-started.js b/packages/agoric-cli/tools/getting-started.js index 5a80be36690..eb580048278 100644 --- a/packages/agoric-cli/tools/getting-started.js +++ b/packages/agoric-cli/tools/getting-started.js @@ -159,35 +159,35 @@ export const gettingStartedWorkflowTest = async (t, options = {}) => { }); t.is(await openP, 0, `open --no-browser exits successfully`); - const testDeploy = async (deployCmd, opts = {}) => { - const deployResult = makePromiseKit(); - const deployP = myMain( - ['deploy', `--hostport=127.0.0.1:${PORT}`, ...deployCmd], - { - stdio: [opts.stdin ? 'pipe' : 'ignore', 'pipe', 'inherit'], - }, - ); - - if (opts.stdin) { - // Write the input to stdin. - deployP.childProcess.stdin.write(opts.stdin); - deployP.childProcess.stdin.end(); - } - - finalizers.push(() => pkill(deployP.childProcess, 'SIGINT')); - const to = setTimeout( - deployResult.resolve, - TIMEOUT_SECONDS * 1000, - 'timeout', - ); - const done = await Promise.race([deployResult.promise, deployP]); - t.is(done, 0, `deploy ${deployCmd.join(' ')} successful before timeout`); - clearTimeout(to); - }; - - // ============== - // agoric deploy ./contract/deploy.js ./api/deploy.js - await testDeploy(['./contract/deploy.js', './api/deploy.js']); + // const testDeploy = async (deployCmd, opts = {}) => { + // const deployResult = makePromiseKit(); + // const deployP = myMain( + // ['deploy', `--hostport=127.0.0.1:${PORT}`, ...deployCmd], + // { + // stdio: [opts.stdin ? 'pipe' : 'ignore', 'pipe', 'inherit'], + // }, + // ); + + // if (opts.stdin) { + // // Write the input to stdin. + // deployP.childProcess.stdin.write(opts.stdin); + // deployP.childProcess.stdin.end(); + // } + + // finalizers.push(() => pkill(deployP.childProcess, 'SIGINT')); + // const to = setTimeout( + // deployResult.resolve, + // TIMEOUT_SECONDS * 1000, + // 'timeout', + // ); + // const done = await Promise.race([deployResult.promise, deployP]); + // t.is(done, 0, `deploy ${deployCmd.join(' ')} successful before timeout`); + // clearTimeout(to); + // }; + + // // ============== + // // agoric deploy ./contract/deploy.js ./api/deploy.js + // await testDeploy(['./contract/deploy.js', './api/deploy.js']); for (const [suffix, code] of [ ['/notthere', 404], From c66fdc60e1e8fda9db7a4af9fe30f245f495b842 Mon Sep 17 00:00:00 2001 From: Luqi Pan Date: Fri, 26 Jan 2024 16:18:24 -0800 Subject: [PATCH 05/15] fix(integration-test): update UI test case --- packages/agoric-cli/tools/getting-started.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/agoric-cli/tools/getting-started.js b/packages/agoric-cli/tools/getting-started.js index eb580048278..a41d4992907 100644 --- a/packages/agoric-cli/tools/getting-started.js +++ b/packages/agoric-cli/tools/getting-started.js @@ -207,11 +207,11 @@ export const gettingStartedWorkflowTest = async (t, options = {}) => { } // ============== - // cd ui && yarn start - const uiStartP = pspawn(`yarn`, ['start'], { + // yarn start:ui + const uiPort = '5173'; + const uiStartP = pspawn(`yarn`, ['start:ui'], { stdio: ['ignore', 'inherit', 'inherit'], - cwd: 'ui', - env: { ...process.env, PORT: '3000' }, + env: { ...process.env }, detached: true, }); finalizers.push(() => pkill(uiStartP.childProcess, 'SIGINT')); @@ -230,7 +230,7 @@ export const gettingStartedWorkflowTest = async (t, options = {}) => { return; } - const req = request('http://localhost:3000/', _res => { + const req = request('http://localhost:${uiPort}/', _res => { resolve('listening'); }); req.setTimeout(2000); From 184994cc966bc904889b8bc62d4626303ca57b4c Mon Sep 17 00:00:00 2001 From: Luqi Pan Date: Fri, 26 Jan 2024 16:59:00 -0800 Subject: [PATCH 06/15] debug(integration-test): use 5173 as port number explicitly --- packages/agoric-cli/tools/getting-started.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/agoric-cli/tools/getting-started.js b/packages/agoric-cli/tools/getting-started.js index a41d4992907..ab144924802 100644 --- a/packages/agoric-cli/tools/getting-started.js +++ b/packages/agoric-cli/tools/getting-started.js @@ -208,7 +208,6 @@ export const gettingStartedWorkflowTest = async (t, options = {}) => { // ============== // yarn start:ui - const uiPort = '5173'; const uiStartP = pspawn(`yarn`, ['start:ui'], { stdio: ['ignore', 'inherit', 'inherit'], env: { ...process.env }, @@ -230,7 +229,7 @@ export const gettingStartedWorkflowTest = async (t, options = {}) => { return; } - const req = request('http://localhost:${uiPort}/', _res => { + const req = request('http://localhost:5173/', _res => { resolve('listening'); }); req.setTimeout(2000); From 5e5e348289073d3ddb81d2e73b3355f6a7fded61 Mon Sep 17 00:00:00 2001 From: Luqi Pan Date: Fri, 26 Jan 2024 17:15:28 -0800 Subject: [PATCH 07/15] fix(integration-test): remove another test that's based on testDeploy --- packages/agoric-cli/tools/getting-started.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/agoric-cli/tools/getting-started.js b/packages/agoric-cli/tools/getting-started.js index ab144924802..13c5dcb83a0 100644 --- a/packages/agoric-cli/tools/getting-started.js +++ b/packages/agoric-cli/tools/getting-started.js @@ -246,16 +246,16 @@ export const gettingStartedWorkflowTest = async (t, options = {}) => { t.is( await Promise.race([uiStartP, uiListening.promise]), 'listening', - `cd ui && yarn start succeeded`, + `yarn start:ui succeeded`, ); clearInterval(ival); - // Test that the Node.js `-r esm`-dependent plugin works. - await (testUnsafePlugins && - testDeploy( - ['--allow-unsafe-plugins', `${dirname}/resm-plugin/deploy.js`], - { stdin: 'yes\n' }, - )); + // // Test that the Node.js `-r esm`-dependent plugin works. + // await (testUnsafePlugins && + // testDeploy( + // ['--allow-unsafe-plugins', `${dirname}/resm-plugin/deploy.js`], + // { stdin: 'yes\n' }, + // )); // TODO: When it exists, Test that the Node.js native ESM plugin works. } finally { From 210c4febe05eadbc405070b72dc2642f9cf31f1f Mon Sep 17 00:00:00 2001 From: Luqi Pan Date: Mon, 11 Mar 2024 08:44:47 -0700 Subject: [PATCH 08/15] chore: remove unused variable --- packages/agoric-cli/tools/getting-started.js | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/agoric-cli/tools/getting-started.js b/packages/agoric-cli/tools/getting-started.js index 13c5dcb83a0..140472477c1 100644 --- a/packages/agoric-cli/tools/getting-started.js +++ b/packages/agoric-cli/tools/getting-started.js @@ -30,7 +30,6 @@ export const gettingStartedWorkflowTest = async (t, options = {}) => { init: initOptions = [], install: installOptions = [], start: startOptions = [], - testUnsafePlugins = false, } = options; // FIXME: Do a search for an unused port or allow specification. const PORT = '7999'; From 9e65b2ca1bb5a53daa340f8aa714978c0ed0cef5 Mon Sep 17 00:00:00 2001 From: Luqi Pan Date: Mon, 11 Mar 2024 17:16:02 -0700 Subject: [PATCH 09/15] ci(integration-test): run a3p container via service container --- .github/workflows/integration.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 05a8e4eaabf..91fd289b6b9 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -41,6 +41,12 @@ jobs: needs: pre_check if: needs.pre_check.outputs.should_run == 'true' runs-on: ubuntu-latest + services: + agoric: + image: ghcr.io/agoric/agoric-3-proposals:latest # simulation of agoric-3 + ports: + - 1317:1317 # api port + - 26657:26657 # rpc port strategy: fail-fast: false matrix: @@ -89,6 +95,26 @@ jobs: git config user.email "noreply@agoric.com" REGISTRY_PUBLISH_WORKSPACES="$HOME/endo" scripts/registry.sh bg-publish ${{ matrix.cli }} + - name: Wait for a3p container to be ready + run: | + timeout 180 bash -c ' + TARGET_HEIGHT=1001 + SLEEP=10 + echo "Waiting for the Agoric service to be fully ready..." + echo "Target block height: $TARGET_HEIGHT" + while true; do + response=$(curl --silent http://localhost:26657/abci_info); + height=$(echo $response | jq -r ".result.response.last_block_height | tonumber"); + if [ "$height" -ge $TARGET_HEIGHT ]; then + echo "Service is ready! Last block height: $height"; + break; + else + echo "Waiting for last block height to reach $TARGET_HEIGHT. Current height: $height"; + fi; + sleep $SLEEP; + done + ' + - name: run agoric-cli integration-test run: scripts/registry.sh test ${{ matrix.cli }} ${{steps.get-branch.outputs.result}} From d687300a99853668acd8daeb5e1e301f9a481853 Mon Sep 17 00:00:00 2001 From: Luqi Pan Date: Mon, 11 Mar 2024 17:18:15 -0700 Subject: [PATCH 10/15] test(integration-test): update the tests to follow current getting-started --- packages/agoric-cli/tools/getting-started.js | 131 +++---------------- 1 file changed, 21 insertions(+), 110 deletions(-) diff --git a/packages/agoric-cli/tools/getting-started.js b/packages/agoric-cli/tools/getting-started.js index 140472477c1..4f63b4790cc 100644 --- a/packages/agoric-cli/tools/getting-started.js +++ b/packages/agoric-cli/tools/getting-started.js @@ -14,16 +14,14 @@ const TIMEOUT_SECONDS = 20 * 60; const dirname = new URL('./', import.meta.url).pathname; -// To keep in sync with https://agoric.com/documentation/getting-started/ +// To keep in sync with https://docs.agoric.com/guides/getting-started/ // Note that we currently only test: // agoric init dapp-foo -// agoric install -// agoric start --reset -// agoric deploy ./contract/deploy.js ./api/deploy.js -// (For simple-exchange and autoswap, the above also makes and accepts offers) -// cd ui && yarn install -// cd ui && yarn start +// yarn install +// yarn start:docker +// yarn start:contract +// yarn start:ui export const gettingStartedWorkflowTest = async (t, options = {}) => { const { @@ -69,6 +67,14 @@ export const gettingStartedWorkflowTest = async (t, options = {}) => { }); } + function yarn(args) { + return pspawnStdout('yarn', args, { + stdio: ['ignore', 'pipe', 'inherit'], + env: { ...process.env }, + detached: true, + }); + } + const olddir = process.cwd(); const { name } = tmp.dirSync({ unsafeCleanup: true, @@ -111,107 +117,21 @@ export const gettingStartedWorkflowTest = async (t, options = {}) => { process.chdir('dapp-foo'); // ============== - // agoric install - if (process.env.AGORIC_INSTALL_OPTIONS) { - const opts = JSON.parse(process.env.AGORIC_INSTALL_OPTIONS); - installOptions.push(...opts); - } - t.is(await myMain(['install', ...installOptions]), 0, 'install works'); + // yarn install + t.is(await yarn(['install']), 0, 'yarn install works'); // ============== - // agoric start --reset - const startResult = makePromiseKit(); + // yarn start:docker - if (process.env.AGORIC_START_OPTIONS) { - const opts = JSON.parse(process.env.AGORIC_START_OPTIONS); - startOptions.push(...opts); - } - - // TODO: Allow this to work even if the port is already used. - const startP = myMain(['start', '--reset', ...startOptions]); - finalizers.push(() => pkill(startP.childProcess, 'SIGINT')); - - let stdoutStr = ''; - if (startP.childProcess.stdout) { - startP.childProcess.stdout.on('data', chunk => { - // console.log('stdout:', chunk.toString()); - stdoutStr += chunk.toString(); - if (stdoutStr.match(/(^|:\s+)swingset running$/m)) { - startResult.resolve(true); - } - }); - } - startP.childProcess.on('close', code => - startResult.reject(Error(`early termination: ${code}`)), - ); - - const timeout = setTimeout( - startResult.reject, - TIMEOUT_SECONDS * 1000, - 'timeout', - ); - t.is(await startResult.promise, true, `swingset running before timeout`); - clearTimeout(timeout); + // Do nothing, as the container is started via GitHub Action service containers - const openP = myMain(['open', '--no-browser'], { - stdio: ['ignore', 'pipe', 'inherit'], - }); - t.is(await openP, 0, `open --no-browser exits successfully`); - - // const testDeploy = async (deployCmd, opts = {}) => { - // const deployResult = makePromiseKit(); - // const deployP = myMain( - // ['deploy', `--hostport=127.0.0.1:${PORT}`, ...deployCmd], - // { - // stdio: [opts.stdin ? 'pipe' : 'ignore', 'pipe', 'inherit'], - // }, - // ); - - // if (opts.stdin) { - // // Write the input to stdin. - // deployP.childProcess.stdin.write(opts.stdin); - // deployP.childProcess.stdin.end(); - // } - - // finalizers.push(() => pkill(deployP.childProcess, 'SIGINT')); - // const to = setTimeout( - // deployResult.resolve, - // TIMEOUT_SECONDS * 1000, - // 'timeout', - // ); - // const done = await Promise.race([deployResult.promise, deployP]); - // t.is(done, 0, `deploy ${deployCmd.join(' ')} successful before timeout`); - // clearTimeout(to); - // }; - - // // ============== - // // agoric deploy ./contract/deploy.js ./api/deploy.js - // await testDeploy(['./contract/deploy.js', './api/deploy.js']); - - for (const [suffix, code] of [ - ['/notthere', 404], - ['', 200], - ]) { - let urlResolve; - const url = `http://127.0.0.1:${PORT}${suffix}`; - const urlP = new Promise(resolve => (urlResolve = resolve)); - const urlReq = request(url, res => urlResolve(res.statusCode)); - urlReq.setTimeout(2000); - urlReq.on('error', err => urlResolve(`Cannot connect to ${url}: ${err}`)); - urlReq.end(); - const urlTimeout = setTimeout(urlResolve, 3000, 'timeout'); - const urlDone = await urlP; - clearTimeout(urlTimeout); - t.is(urlDone, code, `${url} gave status ${code}`); - } + // ============== + // yarn start:contract + t.is(await yarn(['start:contract']), 0, 'yarn start:contract works'); // ============== // yarn start:ui - const uiStartP = pspawn(`yarn`, ['start:ui'], { - stdio: ['ignore', 'inherit', 'inherit'], - env: { ...process.env }, - detached: true, - }); + const uiStartP = yarn(['start:ui']); finalizers.push(() => pkill(uiStartP.childProcess, 'SIGINT')); const uiListening = makePromiseKit(); let retries = 0; @@ -248,15 +168,6 @@ export const gettingStartedWorkflowTest = async (t, options = {}) => { `yarn start:ui succeeded`, ); clearInterval(ival); - - // // Test that the Node.js `-r esm`-dependent plugin works. - // await (testUnsafePlugins && - // testDeploy( - // ['--allow-unsafe-plugins', `${dirname}/resm-plugin/deploy.js`], - // { stdin: 'yes\n' }, - // )); - - // TODO: When it exists, Test that the Node.js native ESM plugin works. } finally { runFinalizers(); process.off('SIGINT', runFinalizers); From 3a3711c07aaf451c39370dd4055e8f97f079450d Mon Sep 17 00:00:00 2001 From: Luqi Pan Date: Mon, 11 Mar 2024 17:33:07 -0700 Subject: [PATCH 11/15] ci(integration-test): run yarn start:docker via getting-started.js --- .github/workflows/integration.yml | 20 -------------------- packages/agoric-cli/tools/getting-started.js | 5 ++++- 2 files changed, 4 insertions(+), 21 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 91fd289b6b9..d1768251bf3 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -95,26 +95,6 @@ jobs: git config user.email "noreply@agoric.com" REGISTRY_PUBLISH_WORKSPACES="$HOME/endo" scripts/registry.sh bg-publish ${{ matrix.cli }} - - name: Wait for a3p container to be ready - run: | - timeout 180 bash -c ' - TARGET_HEIGHT=1001 - SLEEP=10 - echo "Waiting for the Agoric service to be fully ready..." - echo "Target block height: $TARGET_HEIGHT" - while true; do - response=$(curl --silent http://localhost:26657/abci_info); - height=$(echo $response | jq -r ".result.response.last_block_height | tonumber"); - if [ "$height" -ge $TARGET_HEIGHT ]; then - echo "Service is ready! Last block height: $height"; - break; - else - echo "Waiting for last block height to reach $TARGET_HEIGHT. Current height: $height"; - fi; - sleep $SLEEP; - done - ' - - name: run agoric-cli integration-test run: scripts/registry.sh test ${{ matrix.cli }} ${{steps.get-branch.outputs.result}} diff --git a/packages/agoric-cli/tools/getting-started.js b/packages/agoric-cli/tools/getting-started.js index 4f63b4790cc..f597b761c9a 100644 --- a/packages/agoric-cli/tools/getting-started.js +++ b/packages/agoric-cli/tools/getting-started.js @@ -122,8 +122,11 @@ export const gettingStartedWorkflowTest = async (t, options = {}) => { // ============== // yarn start:docker + t.is(await yarn(['start:docker']), 0, 'yarn start:docker works'); - // Do nothing, as the container is started via GitHub Action service containers + // TODO: use abci_info endpoint to get block height + // sleep for 180 seconds for now + await new Promise(resolve => setTimeout(resolve, 180000)); // ============== // yarn start:contract From ba76a1e0151e512eb63d79808d289c9bd7c2ac20 Mon Sep 17 00:00:00 2001 From: Luqi Pan Date: Mon, 11 Mar 2024 17:42:01 -0700 Subject: [PATCH 12/15] ci(integration-test): remove service container --- .github/workflows/integration.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index d1768251bf3..05a8e4eaabf 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -41,12 +41,6 @@ jobs: needs: pre_check if: needs.pre_check.outputs.should_run == 'true' runs-on: ubuntu-latest - services: - agoric: - image: ghcr.io/agoric/agoric-3-proposals:latest # simulation of agoric-3 - ports: - - 1317:1317 # api port - - 26657:26657 # rpc port strategy: fail-fast: false matrix: From 5a4b29c626e7f8639f74635547adeab6ce2cff26 Mon Sep 17 00:00:00 2001 From: Luqi Pan Date: Mon, 11 Mar 2024 18:03:10 -0700 Subject: [PATCH 13/15] chore(integration-test): fix linting errors --- packages/agoric-cli/tools/getting-started.js | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/packages/agoric-cli/tools/getting-started.js b/packages/agoric-cli/tools/getting-started.js index f597b761c9a..252c32606cb 100644 --- a/packages/agoric-cli/tools/getting-started.js +++ b/packages/agoric-cli/tools/getting-started.js @@ -1,4 +1,4 @@ -/* global process setTimeout clearTimeout setInterval clearInterval */ +/* global process setTimeout setInterval clearInterval */ import fs from 'fs'; import path from 'path'; @@ -10,7 +10,7 @@ import { spawn } from 'child_process'; import { makePspawn } from '../src/helpers.js'; -const TIMEOUT_SECONDS = 20 * 60; +const TIMEOUT_SECONDS = 3 * 60; const dirname = new URL('./', import.meta.url).pathname; @@ -26,13 +26,7 @@ const dirname = new URL('./', import.meta.url).pathname; export const gettingStartedWorkflowTest = async (t, options = {}) => { const { init: initOptions = [], - install: installOptions = [], - start: startOptions = [], } = options; - // FIXME: Do a search for an unused port or allow specification. - const PORT = '7999'; - process.env.PORT = PORT; - const pspawn = makePspawn({ spawn }); // Kill an entire process group. @@ -88,7 +82,7 @@ export const gettingStartedWorkflowTest = async (t, options = {}) => { try { f(); } catch (e) { - // console.log(e); + console.log(e); } } if (sig) { @@ -126,7 +120,7 @@ export const gettingStartedWorkflowTest = async (t, options = {}) => { // TODO: use abci_info endpoint to get block height // sleep for 180 seconds for now - await new Promise(resolve => setTimeout(resolve, 180000)); + await new Promise(resolve => setTimeout(resolve, TIMEOUT_SECONDS)); // ============== // yarn start:contract From 93435bcfb2997e5b6b4f243ff4f2b991a10ebae5 Mon Sep 17 00:00:00 2001 From: Luqi Pan Date: Mon, 11 Mar 2024 18:24:13 -0700 Subject: [PATCH 14/15] format(integration-test): let prettier run --- packages/agoric-cli/tools/getting-started.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/agoric-cli/tools/getting-started.js b/packages/agoric-cli/tools/getting-started.js index 252c32606cb..1fe273d8c00 100644 --- a/packages/agoric-cli/tools/getting-started.js +++ b/packages/agoric-cli/tools/getting-started.js @@ -24,9 +24,7 @@ const dirname = new URL('./', import.meta.url).pathname; // yarn start:ui export const gettingStartedWorkflowTest = async (t, options = {}) => { - const { - init: initOptions = [], - } = options; + const { init: initOptions = [] } = options; const pspawn = makePspawn({ spawn }); // Kill an entire process group. From 794d8fe3f32fbdac7240cd90ca184f8b7e0b4699 Mon Sep 17 00:00:00 2001 From: Luqi Pan Date: Tue, 12 Mar 2024 12:20:01 -0700 Subject: [PATCH 15/15] chore(integration-test): update comments and variable name --- packages/agoric-cli/tools/getting-started.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/packages/agoric-cli/tools/getting-started.js b/packages/agoric-cli/tools/getting-started.js index 1fe273d8c00..dae31eeb298 100644 --- a/packages/agoric-cli/tools/getting-started.js +++ b/packages/agoric-cli/tools/getting-started.js @@ -50,7 +50,6 @@ export const gettingStartedWorkflowTest = async (t, options = {}) => { const { AGORIC_CMD = JSON.stringify(defaultAgoricCmd()) } = process.env; const agoricCmd = JSON.parse(AGORIC_CMD); function myMain(args, opts = {}) { - // console.error('running agoric-cli', ...extraArgs, ...args); return pspawnStdout(agoricCmd[0], [...agoricCmd.slice(1), ...args], { stdio: ['ignore', 'pipe', 'inherit'], env: { ...process.env, DEBUG: 'agoric:debug' }, @@ -116,8 +115,8 @@ export const gettingStartedWorkflowTest = async (t, options = {}) => { // yarn start:docker t.is(await yarn(['start:docker']), 0, 'yarn start:docker works'); - // TODO: use abci_info endpoint to get block height - // sleep for 180 seconds for now + // XXX: use abci_info endpoint to get block height + // sleep to let contract start await new Promise(resolve => setTimeout(resolve, TIMEOUT_SECONDS)); // ============== @@ -126,8 +125,8 @@ export const gettingStartedWorkflowTest = async (t, options = {}) => { // ============== // yarn start:ui - const uiStartP = yarn(['start:ui']); - finalizers.push(() => pkill(uiStartP.childProcess, 'SIGINT')); + const startUiP = yarn(['start:ui']); + finalizers.push(() => pkill(startUiP.childProcess, 'SIGINT')); const uiListening = makePromiseKit(); let retries = 0; const ival = setInterval(() => { @@ -158,7 +157,7 @@ export const gettingStartedWorkflowTest = async (t, options = {}) => { } }, 3000); t.is( - await Promise.race([uiStartP, uiListening.promise]), + await Promise.race([startUiP, uiListening.promise]), 'listening', `yarn start:ui succeeded`, );