From f6e0f320a5900c188ef14cf22c2755aa535ee9b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kat=20March=C3=A1n?= Date: Wed, 29 Apr 2026 11:50:09 -0700 Subject: [PATCH] chore: make CI more reliable --- .github/workflows/main.yml | 20 +++++------ integration-tests/js-compute/setup.js | 46 ++++++++++++------------ integration-tests/js-compute/teardown.js | 45 +++++++++++------------ integration-tests/js-compute/test.js | 32 ++++++++++------- integration-tests/js-compute/util.js | 6 ++++ 5 files changed, 82 insertions(+), 67 deletions(-) create mode 100644 integration-tests/js-compute/util.js diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7639d780e0..122a293329 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -261,7 +261,7 @@ jobs: with: path: "/home/runner/.cargo/bin/viceroy" key: crate-cache-viceroy-${{ env.viceroy_version }} - + - name: Restore wasm-tools from cache uses: actions/cache@v3 id: wasm-tools @@ -403,18 +403,18 @@ jobs: run: npm run build:cli - name: Run Tests - run: SUFFIX_STRING=${{matrix.profile}} node integration-tests/js-compute/test.js --ci --skip-teardown${{ matrix.platform == 'viceroy' && ' --local' || '' }}${{ matrix.profile == 'weval' && ' --aot' || '' }}${{ matrix.features == 'http-cache' && ' --http-cache' || '' }} + run: SUFFIX_STRING=${{matrix.profile}}-${{ github.run_id }}-${{ github.run_attempt }} node integration-tests/js-compute/test.js --ci --skip-teardown${{ matrix.platform == 'viceroy' && ' --local' || '' }}${{ matrix.profile == 'weval' && ' --aot' || '' }}${{ matrix.features == 'http-cache' && ' --http-cache' || '' }} env: FASTLY_API_TOKEN: ${{ secrets.FASTLY_API_TOKEN }} - name: Run Module Mode Tests - run: SUFFIX_STRING=${{matrix.profile}} node integration-tests/js-compute/test.js --ci --fixture=module-mode${{ matrix.platform == 'viceroy' && ' --local' || '' }}${{ matrix.profile == 'weval' && ' --aot' || '' }}${{ matrix.features == 'http-cache' && ' --http-cache' || '' }} + run: SUFFIX_STRING=${{matrix.profile}}-${{ github.run_id }}-${{ github.run_attempt }} node integration-tests/js-compute/test.js --ci --fixture=module-mode${{ matrix.platform == 'viceroy' && ' --local' || '' }}${{ matrix.profile == 'weval' && ' --aot' || '' }}${{ matrix.features == 'http-cache' && ' --http-cache' || '' }} env: - FASTLY_API_TOKEN: ${{ secrets.FASTLY_API_TOKEN }} + FASTLY_API_TOKEN: ${{ secrets.FASTLY_API_TOKEN }} - name: Run Reusable Sandbox Tests if: matrix.platform == 'viceroy' - run: SUFFIX_STRING=${{matrix.profile}} node integration-tests/js-compute/test.js --ci --serial --fixture=reusable-sandboxes --local${{ matrix.profile == 'weval' && ' --aot' || '' }}${{ matrix.features == 'http-cache' && ' --http-cache' || '' }} + run: SUFFIX_STRING=${{matrix.profile}}-${{ github.run_id }}-${{ github.run_attempt }} node integration-tests/js-compute/test.js --ci --serial --fixture=reusable-sandboxes --local${{ matrix.profile == 'weval' && ' --aot' || '' }}${{ matrix.features == 'http-cache' && ' --http-cache' || '' }} env: FASTLY_API_TOKEN: ${{ secrets.FASTLY_API_TOKEN }} @@ -478,17 +478,17 @@ jobs: run: npm run build:cli - name: Run Tests - run: SUFFIX_STRING=debug node integration-tests/js-compute/test.js --ci --skip-teardown --debug-build${{ matrix.platform == 'viceroy' && ' --local' || '' }}${{ matrix.features == 'http-cache' && ' --http-cache' || '' }} + run: SUFFIX_STRING=debug-${{ github.run_id }}-${{ github.run_attempt }} node integration-tests/js-compute/test.js --ci --skip-teardown --debug-build${{ matrix.platform == 'viceroy' && ' --local' || '' }}${{ matrix.features == 'http-cache' && ' --http-cache' || '' }} env: FASTLY_API_TOKEN: ${{ secrets.FASTLY_API_TOKEN }} - name: Run Module Mode Tests - run: SUFFIX_STRING=debug node integration-tests/js-compute/test.js --ci --fixture=module-mode --debug-build${{ matrix.platform == 'viceroy' && ' --local' || '' }}${{ matrix.features == 'http-cache' && ' --http-cache' || '' }} + run: SUFFIX_STRING=debug-${{ github.run_id }}-${{ github.run_attempt }} node integration-tests/js-compute/test.js --ci --fixture=module-mode --debug-build${{ matrix.platform == 'viceroy' && ' --local' || '' }}${{ matrix.features == 'http-cache' && ' --http-cache' || '' }} env: - FASTLY_API_TOKEN: ${{ secrets.FASTLY_API_TOKEN }} + FASTLY_API_TOKEN: ${{ secrets.FASTLY_API_TOKEN }} - name: Run Reusable Sandbox Tests if: matrix.platform == 'viceroy' - run: SUFFIX_STRING=debug node integration-tests/js-compute/test.js --ci --serial --fixture=reusable-sandboxes --debug-build${{ matrix.platform == 'viceroy' && ' --local' || '' }}${{ matrix.features == 'http-cache' && ' --http-cache' || '' }} + run: SUFFIX_STRING=debug-${{ github.run_id }}-${{ github.run_attempt }} node integration-tests/js-compute/test.js --ci --serial --fixture=reusable-sandboxes --debug-build${{ matrix.platform == 'viceroy' && ' --local' || '' }}${{ matrix.features == 'http-cache' && ' --http-cache' || '' }} env: - FASTLY_API_TOKEN: ${{ secrets.FASTLY_API_TOKEN }} + FASTLY_API_TOKEN: ${{ secrets.FASTLY_API_TOKEN }} diff --git a/integration-tests/js-compute/setup.js b/integration-tests/js-compute/setup.js index cb75d09605..5e4f2610d3 100755 --- a/integration-tests/js-compute/setup.js +++ b/integration-tests/js-compute/setup.js @@ -4,6 +4,8 @@ import { $ as zx } from 'zx'; import { argv } from 'node:process'; import { getEnv } from './env.js'; +import { $ } from './util.js'; + const serviceId = argv[2]; const serviceName = argv[3]; @@ -29,7 +31,7 @@ if (process.env.FASTLY_API_TOKEN === undefined) { zx.verbose = false; try { process.env.FASTLY_API_TOKEN = String( - await zx`fastly profile token --quiet`, + await $`fastly profile token --quiet`, ).trim(); } catch { console.error( @@ -45,21 +47,21 @@ if (process.env.FASTLY_API_TOKEN === undefined) { async function setupConfigStores() { const stores = JSON.parse( - await zx`fastly config-store list --quiet --json --token $FASTLY_API_TOKEN`, + await $`fastly config-store list --quiet --json --token $FASTLY_API_TOKEN`, ); let STORE_ID = existingListId(stores, DICTIONARY_NAME); if (!STORE_ID) { console.log(`Creating new config store ${DICTIONARY_NAME}`); STORE_ID = JSON.parse( - await zx`fastly config-store create --quiet --name="$DICTIONARY_NAME" --json --token $FASTLY_API_TOKEN`, + await $`fastly config-store create --quiet --name="$DICTIONARY_NAME" --json --token $FASTLY_API_TOKEN`, ).id; } else { console.log(`Using existing config store ${DICTIONARY_NAME}`); } - await zx`echo -n 'https://twitter.com/fastly' | fastly config-store-entry update --upsert --key twitter --store-id=${STORE_ID} --stdin --token $FASTLY_API_TOKEN`; + await $`echo -n 'https://twitter.com/fastly' | fastly config-store-entry update --upsert --key twitter --store-id=${STORE_ID} --stdin --token $FASTLY_API_TOKEN`; try { - await zx`fastly resource-link create --service-id ${serviceId} --version latest --resource-id ${STORE_ID} --token $FASTLY_API_TOKEN --autoclone`; + await $`fastly service resource-link create --service-id ${serviceId} --version latest --resource-id ${STORE_ID} --token $FASTLY_API_TOKEN --autoclone`; } catch (e) { if (!e.message.includes('Duplicate record')) throw e; } @@ -68,14 +70,14 @@ async function setupConfigStores() { if (!STORE_ID) { console.log(`Creating new config store ${CONFIG_STORE_NAME}`); STORE_ID = JSON.parse( - await zx`fastly config-store create --quiet --name="$CONFIG_STORE_NAME" --json --token $FASTLY_API_TOKEN`, + await $`fastly config-store create --quiet --name="$CONFIG_STORE_NAME" --json --token $FASTLY_API_TOKEN`, ).id; } else { console.log(`Using existing config store ${CONFIG_STORE_NAME}`); } - await zx`echo -n 'https://twitter.com/fastly' | fastly config-store-entry update --upsert --key twitter --store-id=${STORE_ID} --stdin --token $FASTLY_API_TOKEN`; + await $`echo -n 'https://twitter.com/fastly' | fastly config-store-entry update --upsert --key twitter --store-id=${STORE_ID} --stdin --token $FASTLY_API_TOKEN`; try { - await zx`fastly resource-link create --service-id ${serviceId} --version latest --resource-id ${STORE_ID} --token $FASTLY_API_TOKEN --autoclone`; + await $`fastly service resource-link create --service-id ${serviceId} --version latest --resource-id ${STORE_ID} --token $FASTLY_API_TOKEN --autoclone`; } catch (e) { if (!e.message.includes('Duplicate record')) throw e; } @@ -83,20 +85,20 @@ async function setupConfigStores() { async function setupKVStore() { let stores = JSON.parse( - await zx`fastly kv-store list --quiet --json --token $FASTLY_API_TOKEN`, + await $`fastly kv-store list --quiet --json --token $FASTLY_API_TOKEN`, ).Data; let STORE_ID = existingListId(stores, KV_STORE_NAME); if (!STORE_ID) { console.log(`Creating new KV store ${KV_STORE_NAME}`); STORE_ID = JSON.parse( - await zx`fastly kv-store create --quiet --name="$KV_STORE_NAME" --json --token $FASTLY_API_TOKEN`, + await $`fastly kv-store create --quiet --name="$KV_STORE_NAME" --json --token $FASTLY_API_TOKEN`, ).StoreID; } else { console.log(`Using existing KV store ${KV_STORE_NAME}`); } try { - await zx`fastly resource-link create --service-id ${serviceId} --version latest --resource-id ${STORE_ID} --token $FASTLY_API_TOKEN --autoclone`; + await $`fastly service resource-link create --service-id ${serviceId} --version latest --resource-id ${STORE_ID} --token $FASTLY_API_TOKEN --autoclone`; } catch (e) { if (!e.message.includes('Duplicate record')) throw e; } @@ -104,23 +106,23 @@ async function setupKVStore() { async function setupSecretStore() { const stores = JSON.parse( - await zx`fastly secret-store list --quiet --json --token $FASTLY_API_TOKEN`, + await $`fastly secret-store list --quiet --json --token $FASTLY_API_TOKEN`, ); let STORE_ID = stores && existingListId(stores, SECRET_STORE_NAME); if (!STORE_ID) { console.log(`Creating new secret store ${SECRET_STORE_NAME}`); STORE_ID = JSON.parse( - await zx`fastly secret-store create --quiet --name="$SECRET_STORE_NAME" --json --token $FASTLY_API_TOKEN`, + await $`fastly secret-store create --quiet --name="$SECRET_STORE_NAME" --json --token $FASTLY_API_TOKEN`, ).id; } else { console.log(`Using existing secret store ${SECRET_STORE_NAME}`); } - await zx`echo -n 'This is also some secret data' | fastly secret-store-entry create --recreate-allow --name first --store-id=${STORE_ID} --stdin --token $FASTLY_API_TOKEN`; + await $`echo -n 'This is also some secret data' | fastly secret-store-entry create --recreate-allow --name first --store-id=${STORE_ID} --stdin --token $FASTLY_API_TOKEN`; let key = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'; - await zx`echo -n 'This is some secret data' | fastly secret-store-entry create --recreate-allow --name ${key} --store-id=${STORE_ID} --stdin --token $FASTLY_API_TOKEN`; + await $`echo -n 'This is some secret data' | fastly secret-store-entry create --recreate-allow --name ${key} --store-id=${STORE_ID} --stdin --token $FASTLY_API_TOKEN`; try { - await zx`fastly resource-link create --service-id ${serviceId} --version latest --resource-id ${STORE_ID} --token $FASTLY_API_TOKEN --autoclone`; + await $`fastly service resource-link create --service-id ${serviceId} --version latest --resource-id ${STORE_ID} --token $FASTLY_API_TOKEN --autoclone`; } catch (e) { if (!e.message.includes('Duplicate record')) throw e; } @@ -129,22 +131,22 @@ async function setupSecretStore() { async function setupAcl() { let ACL_ID = existingListId( JSON.parse( - await zx`fastly compute acl list-acls --quiet --json --token $FASTLY_API_TOKEN`, + await $`fastly compute acl list-acls --quiet --json --token $FASTLY_API_TOKEN`, ).data, ACL_NAME, ); if (!ACL_ID) { console.log(`Creating ACL ${ACL_NAME}`); ACL_ID = JSON.parse( - await zx`fastly compute acl create --name="$ACL_NAME" --token $FASTLY_API_TOKEN --json`, + await $`fastly compute acl create --name="$ACL_NAME" --token $FASTLY_API_TOKEN --json`, ).id; - await zx`fastly compute acl update --acl-id=${ACL_ID} --operation=create --prefix=100.100.0.0/16 --action=BLOCK --token $FASTLY_API_TOKEN`; - await zx`fastly compute acl update --acl-id=${ACL_ID} --operation=create --prefix=2a03:4b80::/32 --action=ALLOW --token $FASTLY_API_TOKEN`; + await $`fastly compute acl update --acl-id=${ACL_ID} --operation=create --prefix=100.100.0.0/16 --action=BLOCK --token $FASTLY_API_TOKEN`; + await $`fastly compute acl update --acl-id=${ACL_ID} --operation=create --prefix=2a03:4b80::/32 --action=ALLOW --token $FASTLY_API_TOKEN`; } else { console.log(`Using existing ACL ${ACL_NAME}`); } try { - await zx`fastly resource-link create --service-id ${serviceId} --version latest --resource-id ${ACL_ID} --token $FASTLY_API_TOKEN --autoclone`; + await $`fastly service resource-link create --service-id ${serviceId} --version latest --resource-id ${ACL_ID} --token $FASTLY_API_TOKEN --autoclone`; } catch (e) { if (!e.message.includes('Duplicate record')) throw e; } @@ -157,4 +159,4 @@ await setupSecretStore(); await setupAcl(); zx.verbose = false; -await zx`fastly service-version activate --service-id ${serviceId} --version latest --token $FASTLY_API_TOKEN`; +await $`fastly service-version activate --service-id ${serviceId} --version latest --token $FASTLY_API_TOKEN`; diff --git a/integration-tests/js-compute/teardown.js b/integration-tests/js-compute/teardown.js index 4a80411ff7..719bbff2f3 100755 --- a/integration-tests/js-compute/teardown.js +++ b/integration-tests/js-compute/teardown.js @@ -1,9 +1,10 @@ #!/usr/bin/env node -import { $ as zx } from 'zx'; import { argv } from 'node:process'; import { getEnv } from './env.js'; +import { $ } from './util.js'; + const serviceId = argv[2]; const serviceName = argv[3]; @@ -25,7 +26,7 @@ const startTime = Date.now(); if (process.env.FASTLY_API_TOKEN === undefined) { try { process.env.FASTLY_API_TOKEN = String( - await zx`fastly profile token --quiet`, + await $`fastly profile token --quiet`, ).trim(); } catch { console.error( @@ -41,10 +42,10 @@ const FASTLY_API_TOKEN = process.env.FASTLY_API_TOKEN; async function removeConfigStores() { const stores = JSON.parse( - await zx`fastly config-store list --quiet --json --token $FASTLY_API_TOKEN`, + await $`fastly config-store list --quiet --json --token $FASTLY_API_TOKEN`, ); const links = JSON.parse( - await zx`fastly resource-link list --service-id=${serviceId} --quiet --json --version latest --token $FASTLY_API_TOKEN`, + await $`fastly service resource-link list --service-id=${serviceId} --quiet --json --version latest --token $FASTLY_API_TOKEN`, ); let STORE_ID = existingListId(stores, DICTIONARY_NAME); @@ -53,10 +54,10 @@ async function removeConfigStores() { ({ resource_id }) => resource_id == STORE_ID, )?.id; if (LINK_ID) { - await zx`fastly resource-link delete --version latest --autoclone --id=${LINK_ID} --token $FASTLY_API_TOKEN`; - await zx`fastly service-version activate --version latest --token $FASTLY_API_TOKEN`; + await $`fastly service resource-link delete --version latest --autoclone --id=${LINK_ID} --token $FASTLY_API_TOKEN`; + await $`fastly service-version activate --version latest --token $FASTLY_API_TOKEN`; } - await zx`fastly config-store delete --store-id=${STORE_ID} --token $FASTLY_API_TOKEN`; + await $`fastly config-store delete --store-id=${STORE_ID} --token $FASTLY_API_TOKEN`; } STORE_ID = existingListId(stores, CONFIG_STORE_NAME); @@ -65,23 +66,23 @@ async function removeConfigStores() { ({ resource_id }) => resource_id == STORE_ID, )?.id; if (LINK_ID) { - await zx`fastly resource-link delete --version latest --autoclone --id=${LINK_ID} --token $FASTLY_API_TOKEN`; - await zx`fastly service-version activate --version latest --token $FASTLY_API_TOKEN`; + await $`fastly service resource-link delete --version latest --autoclone --id=${LINK_ID} --token $FASTLY_API_TOKEN`; + await $`fastly service-version activate --version latest --token $FASTLY_API_TOKEN`; } try { - await zx`fastly config-store delete --store-id=${STORE_ID} --token $FASTLY_API_TOKEN`; + await $`fastly config-store delete --store-id=${STORE_ID} --token $FASTLY_API_TOKEN`; } catch {} } } async function removeKVStore() { const stores = JSON.parse( - await zx`fastly kv-store list --quiet --json --token $FASTLY_API_TOKEN`, + await $`fastly kv-store list --quiet --json --token $FASTLY_API_TOKEN`, ).Data; let STORE_ID = existingListId(stores, KV_STORE_NAME); if (STORE_ID) { - await zx`fastly kv-store delete --store-id=${STORE_ID} --quiet --all -y --token $FASTLY_API_TOKEN`; + await $`fastly kv-store delete --store-id=${STORE_ID} --quiet --all -y --token $FASTLY_API_TOKEN`; } else { console.error(`Unable to find KV Store ${KV_STORE_NAME} to delete`); } @@ -89,10 +90,10 @@ async function removeKVStore() { async function removeSecretStore() { const stores = JSON.parse( - await zx`fastly secret-store list --quiet --json --token $FASTLY_API_TOKEN`, + await $`fastly secret-store list --quiet --json --token $FASTLY_API_TOKEN`, ); const links = JSON.parse( - await zx`fastly resource-link list --service-id=${serviceId} --quiet --json --version latest --token $FASTLY_API_TOKEN`, + await $`fastly service resource-link list --service-id=${serviceId} --quiet --json --version latest --token $FASTLY_API_TOKEN`, ); const STORE_ID = existingListId(stores, SECRET_STORE_NAME); @@ -101,11 +102,11 @@ async function removeSecretStore() { ({ resource_id }) => resource_id == STORE_ID, )?.id; if (LINK_ID) { - await zx`fastly resource-link delete --version latest --autoclone --id=${LINK_ID} --token $FASTLY_API_TOKEN`; - await zx`fastly service-version activate --version latest --token $FASTLY_API_TOKEN`; + await $`fastly service resource-link delete --version latest --autoclone --id=${LINK_ID} --token $FASTLY_API_TOKEN`; + await $`fastly service-version activate --version latest --token $FASTLY_API_TOKEN`; } try { - await zx`fastly secret-store delete --store-id=${STORE_ID} --token $FASTLY_API_TOKEN`; + await $`fastly secret-store delete --store-id=${STORE_ID} --token $FASTLY_API_TOKEN`; } catch {} } } @@ -113,22 +114,22 @@ async function removeSecretStore() { async function removeAcl() { const ACL_ID = existingListId( JSON.parse( - await zx`fastly compute acl list-acls --quiet --json --token $FASTLY_API_TOKEN`, + await $`fastly compute acl list-acls --quiet --json --token $FASTLY_API_TOKEN`, ).data, ACL_NAME, ); const links = JSON.parse( - await zx`fastly resource-link list --service-id=${serviceId} --quiet --json --version latest --token $FASTLY_API_TOKEN`, + await $`fastly service resource-link list --service-id=${serviceId} --quiet --json --version latest --token $FASTLY_API_TOKEN`, ); const LINK_ID = links.find(({ resource_id }) => resource_id == ACL_ID)?.id; if (LINK_ID) { - await zx`fastly resource-link delete --version latest --autoclone --id=${LINK_ID} --token $FASTLY_API_TOKEN`; - await zx`fastly service-version activate --version latest --token $FASTLY_API_TOKEN`; + await $`fastly service resource-link delete --version latest --autoclone --id=${LINK_ID} --token $FASTLY_API_TOKEN`; + await $`fastly service-version activate --version latest --token $FASTLY_API_TOKEN`; } if (ACL_ID) { - await zx`fastly compute acl delete --acl-id=${ACL_ID} --token $FASTLY_API_TOKEN`; + await $`fastly compute acl delete --acl-id=${ACL_ID} --token $FASTLY_API_TOKEN`; } } diff --git a/integration-tests/js-compute/test.js b/integration-tests/js-compute/test.js index 8a051bd46c..5063cd3fe9 100755 --- a/integration-tests/js-compute/test.js +++ b/integration-tests/js-compute/test.js @@ -11,6 +11,7 @@ import { copyFile, readFile, writeFile } from 'node:fs/promises'; import * as core from '@actions/core'; import TOML from '@iarna/toml'; import { getEnv, GLOBAL_PREFIX } from './env.js'; +import { $ } from './util.js'; // test environment variable handling process.env.LOCAL_TEST = 'local val'; @@ -52,15 +53,11 @@ const filter = args.filter((arg) => !arg.startsWith('--')); const bail = args.includes('--bail'); const ci = args.includes('--ci'); -async function $(...args) { - return await retry(10, () => zx(...args)); -} - if (!local && process.env.FASTLY_API_TOKEN === undefined) { try { zx.verbose = false; process.env.FASTLY_API_TOKEN = String( - await zx`fastly auth show --reveal | grep 'Token:' | cut -d ' ' -f2-`, + await $`fastly auth show --reveal | grep 'Token:' | cut -d ' ' -f2-`, ).trim(); } catch { console.error( @@ -143,18 +140,27 @@ if (!local) { await zx`fastly service delete --quiet --service-name "${serviceName}" --force --token $FASTLY_API_TOKEN`; } catch {} core.endGroup(); + await new Promise((resolve) => setTimeout(resolve, 5000)); core.startGroup('Build and deploy service'); await zx`npm i`; await $`fastly compute publish -i ${verbose ? '--verbose' : '--quiet'} --token $FASTLY_API_TOKEN --status-check-off`; core.endGroup(); - // get the public domain of the deployed application - const domainListing = JSON.parse( - await $`fastly service domain list --quiet --version latest --json`, - )[0]; - domain = `https://${domainListing.Name}`; - serviceId = domainListing.ServiceID; - core.notice(`Service is running on ${domain}`); + // It can take time for the new domain to show up on the list. + await Promise.all([ + (async () => { + await retry(27, expBackoff('60s', '10s'), async () => { + // get the public domain of the deployed application + const domainListing = JSON.parse( + await $`fastly service domain list --quiet --version latest --json`, + )[0]; + domain = `https://${domainListing.Name}`; + serviceId = domainListing.ServiceID; + core.notice(`Service is running on ${domain}`); + }); + })(), + new Promise((resolve) => setTimeout(resolve, 60_000)), + ]); } else { const pushpin = '--local-pushpin-proxy-port=0'; const args = verbose ? '-vv ' + pushpin : pushpin; @@ -475,7 +481,7 @@ if (!local && !skipTeardown) { core.startGroup('Delete service'); // Delete the service now the tests have finished - await zx`fastly service delete --quiet --service-name "${serviceName}" --force --token $FASTLY_API_TOKEN`; + await $`fastly service delete --quiet --service-name "${serviceName}" --force --token $FASTLY_API_TOKEN`; core.endGroup(); } if (process.exitCode == undefined || process.exitCode == 0) { diff --git a/integration-tests/js-compute/util.js b/integration-tests/js-compute/util.js new file mode 100644 index 0000000000..c6fb62931e --- /dev/null +++ b/integration-tests/js-compute/util.js @@ -0,0 +1,6 @@ +import { cd, $ as zx, retry, expBackoff } from 'zx'; + +export async function $(...args) { + await new Promise((resolve) => setTimeout(resolve, 3000)); + return await retry(10, expBackoff('60s', '10s'), async () => zx(...args)); +}