Moved image test to a script to be run in the image

This commit is contained in:
Laurent Goderre 2018-03-23 10:59:15 -04:00
parent a9c460cc85
commit 193e04ae6b
2 changed files with 20 additions and 21 deletions

View File

@ -27,21 +27,7 @@ for version in "${versions[@]}"; do
fi
info "Build of $tag succeeded."
OUTPUT=$(docker run --rm -it node:"$tag" node -e "process.stdout.write(process.versions.node)")
if [ "$OUTPUT" != "$full_version" ]; then
fatal "Test of $tag for node failed!"
fi
info "Test of $tag for node succeeded."
if ! docker run --rm -i node:"$tag" npm --version; then
fatal "Test of $tag for npm failed!"
fi
info "Test of $tag for npm succeeded."
if ! docker run --rm -i node:"$tag" yarn --version; then
fatal "Test of $tag for yarn failed!"
fi
info "Test of $tag for yarn succeeded."
docker run --rm -v "$PWD/test-image.sh:/usr/local/bin/test.sh" node:"$tag" test.sh "$full_version"
# Get supported variants according to the target architecture.
# See details in function.sh
@ -58,12 +44,7 @@ for version in "${versions[@]}"; do
fi
info "Build of $tag-$variant succeeded."
OUTPUT=$(docker run --rm -it node:"$tag-$variant" node -e "process.stdout.write(process.versions.node)")
if [ "$OUTPUT" != "$full_version" ]; then
fatal "Test of $tag-$variant failed!"
fi
info "Test of $tag-$variant succeeded."
docker run --rm -v "$PWD/test-image.sh:/usr/local/bin/test.sh" node:"$tag-$variant" test.sh "$full_version"
done
done

18
test-image.sh Executable file
View File

@ -0,0 +1,18 @@
#!/bin/sh
if [ "$(node -e "process.stdout.write(process.versions.node)")" != "$1" ]; then
echo "Test for node failed!"
exit 1
fi
echo "Test for node succeeded."
if ! npm --version > /dev/null; then
echo "Test for npm failed!"
exit 2
fi
echo "Test for npm succeeded."
if ! yarn --version > /dev/null; then
echo "Test of yarn failed!"
exit 3
fi
echo "Test for yarn succeeded."