From 1bf35a1db7c326ddc661c444a075e0d73a462544 Mon Sep 17 00:00:00 2001 From: Eric Swanson <64809312+ericswanson-dfinity@users.noreply.github.com> Date: Tue, 26 Sep 2023 15:37:06 -0700 Subject: [PATCH] test: retry mops sources call in playground e2e tests (#3392) The `mops sources` command in the playground e2e tests fails often. The retry logic in the JS agent misses some classes of failures (basically, if `fetch` throws). Pending a fix for that, this change retries the `mops sources` call up to a few times, with simple/naive backoff. Example test failures: - https://github.com/dfinity/sdk/actions/runs/6114033428/job/16595080284#step:10:111 - https://github.com/dfinity/sdk/actions/runs/6090058722/job/16524749754#step:10:108 - https://github.com/dfinity/sdk/actions/runs/5929218365/job/16076870508#step:10:109 - https://github.com/dfinity/sdk/actions/runs/5858605218/job/15883717915#step:10:107 - https://github.com/dfinity/sdk/actions/runs/6316833146/job/17152786799?pr=3391 --- e2e/assets/playground_backend/dfx.json | 2 +- e2e/assets/playground_backend/mops-sources | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100755 e2e/assets/playground_backend/mops-sources diff --git a/e2e/assets/playground_backend/dfx.json b/e2e/assets/playground_backend/dfx.json index dbae6de715..afdd89f86b 100644 --- a/e2e/assets/playground_backend/dfx.json +++ b/e2e/assets/playground_backend/dfx.json @@ -19,7 +19,7 @@ "defaults": { "build": { "output": "build", - "packtool": "mops sources" + "packtool": "./mops-sources" } } } \ No newline at end of file diff --git a/e2e/assets/playground_backend/mops-sources b/e2e/assets/playground_backend/mops-sources new file mode 100755 index 0000000000..56be5bd50a --- /dev/null +++ b/e2e/assets/playground_backend/mops-sources @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +set -e + +for i in 0 2 4 8 16 32; do + if [ $i -gt 0 ]; then + echo "retrying in $i seconds" 1>&2 + sleep $i + fi + + if output=$(mops sources); then + echo "$output" + exit 0 + fi + echo "failed with output: $output" 1>&2 +done +exit 1