+ split docker images successful

This commit is contained in:
Lucas Briese
2019-07-21 23:04:00 +02:00
parent 62ef6948a1
commit df253d53e1
24 changed files with 775 additions and 17 deletions

12
test/testBuild.sh Normal file
View File

@ -0,0 +1,12 @@
#!/bin/bash
if [ "${DEBUGGING:?}" = "true" ]; then
set -o xtrace
fi
set -o errexit
set -o nounset
set -o pipefail
docker rmi "jusito/docker-ttt:ubuntu" || true
docker build -t "jusito/docker-ttt:ubuntu" "."

22
test/testCaseQuick.sh Normal file
View File

@ -0,0 +1,22 @@
#!/bin/bash
if [ "${DEBUGGING}" = "true" ]; then
set -o xtrace
fi
set -o errexit
set -o nounset
set -o pipefail
#bash test/testStyle.sh
echo "[testBuild][INFO]build docker-ttt:ubuntu"
docker rmi "jusito/docker-ttt:ubuntu" || true
docker build -t "jusito/docker-ttt:ubuntu" "."
echo "[testRun][INFO]running docker-ttt:ubuntu"
if ! docker run -ti --name "JusitoTesting" --rm -e TEST_MODE=true -e DEBUGGING="${DEBUGGING}" "jusito/docker-ttt:ubuntu"; then
echo "[testRun][ERROR]run test failed for docker-ttt:ubuntu"
exit 1
fi
docker stop "JusitoTesting" || true
docker rm "JusitoTesting" || true

33
test/testCaseQuick2.sh Normal file
View File

@ -0,0 +1,33 @@
#!/bin/bash
if [ "${DEBUGGING}" = "true" ]; then
set -o xtrace
else
DEBUGGING="false"
fi
set -o errexit
set -o nounset
set -o pipefail
#bash test/testStyle.sh
echo "[testBuild][INFO]build"
docker rmi "jusito/docker-ttt:lgsm_debian" || true
docker build -t "jusito/docker-ttt:lgsm_debian" "./lgsm/"
docker rmi "jusito/docker-ttt:gmod_debian" || true
docker build -t "jusito/docker-ttt:gmod_debian" "./gmod/"
docker rmi "jusito/docker-ttt:gmod_ttt_debian" || true
docker build -t "jusito/docker-ttt:gmod_ttt_debian" "./TTT/"
echo "[testRun][INFO]running"
if ! docker run -ti --name "JusitoTesting" --rm -e TEST_MODE=true -e DEBUGGING="$DEBUGGING" "jusito/docker-ttt:gmod_ttt_debian"; then
echo "[testRun][ERROR]run test failed for docker-ttt:ubuntu"
exit 1
fi
docker stop "JusitoTesting" || true
docker rm "JusitoTesting" || true

13
test/testHealth.sh Normal file
View File

@ -0,0 +1,13 @@
#!/bin/bash
if [ "${DEBUGGING:?}" = "true" ]; then
set -o xtrace
fi
set -o errexit
set -o nounset
set -o pipefail
docker exec -it CONTAINER ./home/steam/gmodserver details
Status: OFFLINE -> fail Health

20
test/testRun.sh Normal file
View File

@ -0,0 +1,20 @@
#!/bin/bash
if [ "${DEBUGGING:?}" = "true" ]; then
set -o xtrace
fi
set -o errexit
set -o nounset
set -o pipefail
docker stop "JusitoTesting" || true
docker rm "JusitoTesting" || true
echo "[testRun][INFO]running docker-ttt:ubuntu"
if ! docker run -ti --name "JusitoTesting" --rm -e TEST_MODE=true -e DEBUGGING="${DEBUGGING}" "jusito/docker-ttt:ubuntu"; then
echo "[testRun][ERROR]run test failed for docker-ttt:ubuntu"
exit 1
fi
docker stop "JusitoTesting" || true
docker rm "JusitoTesting" || true

54
test/testStyle.sh Normal file
View File

@ -0,0 +1,54 @@
#!/bin/sh
if [ "${DEBUGGING}" = "true" ]; then
set -o xtrace
fi
set -o errexit
set -o nounset
set -o pipefail
# test sha3sums
#if ! printf '%s %s' "$(grep -Eo "grep -Eq '\^[^\\]+" Dockerfile | sed 's/...........//')" "checkHealth.sh" | sha3sum -c ; then
# echo "[testStyle][ERROR]Sha3sum of checkHealth.sh in Dockerfile invalid"
# exit 2
#fi
directory="$PWD"
echo "[testStyle][INFO]workdir $directory"
check() {
file="$1"
exclude=""
if [ -n "$2" ]; then
exclude="--exclude=$2"
fi
echo "[testStyle][INFO]processing $file with extra arg: $exclude"
# shellcheck disable=SC2086
if shellcheck $exclude "$file"; then
return 0
else
echo "[testStyle][ERROR]style is bad"
return 1
fi
}
find "${directory}" -maxdepth 1 -type f -iname '*.sh' |
while read -r filename
do
if ! check "$filename" ''; then
exit 1
fi
done
# shellcheck disable=SC2181
if [ "$?" = "0" ]; then
echo "[testStyle][INFO]all elements passed style check"
exit 0
else
echo "[testStyle][ERROR]style in at least one element looks bad"
exit 1
fi