| index e3c6a38..2d35e30 100755 |
| --- a/scripts/prepare-apps_test.sh |
| +++ b/scripts/prepare-apps_test.sh |
| @@ -47,11 +47,18 @@ exit 0 |
| FAKE |
| chmod +x "$work/bin/carlos" |
| |
| +# The catalogue's app ids, read the way the script reads them, so a new |
| +# catalogue entry (Contra's binary comes from another repo) needs no edit here. |
| +catalog_ids=$(grep -o '"id": *"[^"]*"' "$here/../internal/catalog/catalog.json" | sed 's/.*: *"\(.*\)"/\1/') |
| + |
| +# What `apps list` prints when the account already has every catalogue app. |
| +all_apps=$(for a in $catalog_ids; do echo "$a x"; done) |
| + |
| # newdir makes a release dir with one build of each catalogue app. |
| newdir() { |
| local d |
| d=$(mktemp -d "$work/rel.XXXXXX") |
| - for a in welcome scratchpad; do |
| + for a in $catalog_ids; do |
| : >"$d/$a-linux-arm64-aaa111" |
| : >"$d/$a-linux-arm64-aaa111.COMMIT" |
| done |
| @@ -82,7 +89,7 @@ export PREPARE_APPS_RETRY_SLEEP=0 |
| |
| # Deploy creates a stray instance, so it must never be called, in any case below. |
| # A failed releases lookup must stop the script before it ships. |
| -FAKE_APPS=$'welcome x\nscratchpad x' FAKE_RELEASES_FAIL=1 \ |
| +FAKE_APPS="$all_apps" FAKE_RELEASES_FAIL=1 \ |
| check "releases lookup failure stops before ship" nonzero '^releases ' '^(deploy|ship|promote) ' -- acme "$d" |
| |
| # An app that is not in this account's listing, and cannot be created, stops it. |
| @@ -95,21 +102,20 @@ FAKE_LIST_FAIL=1 \ |
| |
| # Several builds of one app and no explicit version is ambiguous. |
| d2=$(newdir) |
| -: >"$d2/welcome-linux-arm64-bbb222" |
| -: >"$d2/scratchpad-linux-arm64-bbb222" |
| +for a in $catalog_ids; do : >"$d2/$a-linux-arm64-bbb222"; done |
| check "ambiguous release dir is refused" nonzero '' '^(apps|deploy|instances|releases) ' -- acme "$d2" |
| grep -qi 'version' "$work/out" || { echo "FAIL ambiguity message should mention version"; fails=$((fails + 1)); } |
| |
| # An explicit version picks the right build out of several. |
| -FAKE_APPS=$'welcome x\nscratchpad x' \ |
| +FAKE_APPS="$all_apps" \ |
| check "explicit version resolves the ambiguity" zero 'ship .*--version bbb222 .*welcome-linux-arm64-bbb222' '^deploy ' -- acme "$d2" bbb222 |
| |
| # Version match is exact: aaa111 listed as a prefix of the shipped version is not shipped. |
| -FAKE_APPS=$'welcome x\nscratchpad x' FAKE_RELEASES='aaa1112 - binary now -' \ |
| +FAKE_APPS="$all_apps" FAKE_RELEASES='aaa1112 - binary now -' \ |
| check "releases match is exact, not substring" zero '^ship ' '^deploy ' -- acme "$d" |
| |
| # Already shipped: promote to edge, don't ship or deploy. Existing apps: no create. |
| -FAKE_APPS=$'welcome x\nscratchpad x' FAKE_RELEASES='aaa111 - binary now -' \ |
| +FAKE_APPS="$all_apps" FAKE_RELEASES='aaa111 - binary now -' \ |
| check "shipped version is only promoted, existing app not created" zero '^promote .* aaa111 edge$' '^(deploy|ship|apps create) ' -- acme "$d" |
| |
| # Fresh account: create, ship, promote to edge, enable, and never deploy or touch stable. |
| @@ -118,12 +124,12 @@ grep -qE '^promote --app scratchpad --account acme --no-prompt aaa111 edge$' "$w |
| grep -qE '^instances enable --app scratchpad' "$work/calls" || { echo "FAIL instances should be enabled"; fails=$((fails + 1)); } |
| |
| # A failing promote stops the script before instances are enabled. |
| -FAKE_APPS=$'welcome x\nscratchpad x' FAKE_PROMOTE_FAIL=1 \ |
| +FAKE_APPS="$all_apps" FAKE_PROMOTE_FAIL=1 \ |
| check "failing promote stops the script" nonzero '^promote ' '^(deploy|instances) ' -- acme "$d" |
| |
| # "too many uploads" is retried until ship works. |
| rm -f "$work/calls.busy" |
| -FAKE_APPS=$'welcome x\nscratchpad x' FAKE_SHIP_BUSY=2 \ |
| +FAKE_APPS="$all_apps" FAKE_SHIP_BUSY=2 \ |
| check "ship is retried while uploads are rate limited" zero '^promote ' '^deploy ' -- acme "$d" |
| [ "$(grep -c '^ship .*welcome' "$work/calls")" -eq 3 ] || { echo "FAIL ship should be tried 3 times"; fails=$((fails + 1)); } |
| |