This repository was archived by the owner on Jan 2, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathtest.sh
More file actions
executable file
·76 lines (56 loc) · 1.39 KB
/
test.sh
File metadata and controls
executable file
·76 lines (56 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/usr/bin/env bash
#
# Run a test for all images.
set -uo pipefail
info() {
printf "%s\n" "$@"
}
fatal() {
printf "**********\n"
printf "%s\n" "$@"
printf "**********\n"
exit 1
}
cd $(cd ${0%/*} && pwd -P);
versions=( "$@" )
if [ ${#versions[@]} -eq 0 ]; then
versions=( */ )
fi
versions=( "${versions[@]%/}" )
for version in "${versions[@]}"; do
echo $version
tag=$(cat $version/Dockerfile | grep "ENV NODE_VERSION" | cut -d' ' -f3)
info "Testing NodeJS version $tag..."
docker run hypriot/rpi-node:$tag node --version
if [[ $? -gt 0 ]]; then
fatal "Test of $tag failed!"
else
info "Test of $tag succeeded."
fi
info "Testing Yarn..."
docker run hypriot/rpi-node:$tag yarn --version
if [[ $? -gt 0 ]]; then
fatal "Test of $tag failed!"
else
info "Test of $tag succeeded."
fi
variants=( slim onbuild )
for variant in "${variants[@]}"; do
info "Testing NodeJS version $tag-$variant variant..."
docker run hypriot/rpi-node:$tag-$variant node --version
if [[ $? -gt 0 ]]; then
fatal "Test of $tag-$variant failed!"
else
info "Test of $tag-$variant succeeded."
fi
info "Testing Yarn-$variant variant..."
docker run hypriot/rpi-node:$tag yarn --version
if [[ $? -gt 0 ]]; then
fatal "Test of $tag failed!"
else
info "Test of $tag succeeded."
fi
done
done
info "All tests successful!"
exit 0