forked from xingjiudong/docker-smtp-relay
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtests.sh
executable file
·38 lines (30 loc) · 1.14 KB
/
tests.sh
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
#!/usr/bin/env bash
## Global settings
# image name
DOCKER_IMAGE="${DOCKER_REPO:-smtp-relay}"
## Initialization
set -e
image_building_name="${DOCKER_IMAGE}:building"
docker_run_options='--detach'
echo "-> use image name '${image_building_name}' for tests"
## Prepare
if [[ -z $(which container-structure-test 2>/dev/null) ]]; then
echo "Retrieving structure-test binary...."
if [[ -n "${TRAVIS_OS_NAME}" && "$TRAVIS_OS_NAME" != 'linux' ]]; then
echo "container-structure-test only released for Linux at this time."
echo "To run on OSX, clone the repository and build using 'make'."
exit 1
else
curl -sS -LO https://storage.googleapis.com/container-structure-test/latest/container-structure-test-linux-amd64 \
&& chmod +x container-structure-test-linux-amd64 \
&& sudo mv container-structure-test-linux-amd64 /usr/local/bin/container-structure-test
fi
fi
# Download tools shim.
if [[ ! -f _tools.sh ]]; then
curl -L -o ${PWD}/_tools.sh https://gist.github.com/Turgon37/2ba8685893807e3637ea3879ef9d2062/raw
fi
source ${PWD}/_tools.sh
## Test
container-structure-test \
test --image "${image_building_name}" --config ./tests.yml