Skip to content

Commit 3ae20f2

Browse files
authored
fix: retry npm install in system test when command hangs (#65)
* chore: retry npm install in system test when command hangs * make npm_install work on alpine
1 parent ff5bc21 commit 3ae20f2

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

system-test/test.sh

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,18 @@ retry() {
66
"${@}" || "${@}" || "${@}" || return 1
77
}
88

9+
function timeout_after() {
10+
if [ -f /bin/busybox ]; then
11+
timeout -t "${@}"
12+
else
13+
timeout "${@}"
14+
fi
15+
}
16+
17+
npm_install() {
18+
timeout_after 60 npm install "${@}"
19+
}
20+
921
set -eox pipefail
1022
cd $(dirname $0)/..
1123

@@ -16,9 +28,9 @@ NODEDIR=$(dirname $(dirname $(which node)))
1628
# contains unreleased fixes that allow the native component to be compiled
1729
# with Node's V8 canary build.
1830
[ -z $NVM_NODEJS_ORG_MIRROR ] \
19-
|| retry npm install https://github.com/nodejs/nan.git
31+
|| retry npm_install https://github.com/nodejs/nan.git
2032

21-
retry npm install --nodedir="$NODEDIR" \
33+
retry npm_install --nodedir="$NODEDIR" \
2234
${BINARY_HOST:+--pprof_binary_host_mirror=$BINARY_HOST} >/dev/null
2335

2436
npm run compile
@@ -30,8 +42,8 @@ TESTDIR=$(mktemp -d)
3042
cp -r "$PWD/system-test/busybench" "$TESTDIR"
3143
cd "$TESTDIR/busybench"
3244

33-
retry npm install pify @types/pify typescript gts @types/node >/dev/null
34-
retry npm install --nodedir="$NODEDIR" \
45+
retry npm_install pify @types/pify typescript gts @types/node >/dev/null
46+
retry npm_install --nodedir="$NODEDIR" \
3547
${BINARY_HOST:+--pprof_binary_host_mirror=$BINARY_HOST} \
3648
"$PROFILER">/dev/null
3749

0 commit comments

Comments
 (0)