/
docker-all_tests.sh
executable file
·33 lines (26 loc) · 1.16 KB
/
docker-all_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
#!/usr/bin/env bash
# Execute this script from the project root directory to run Curator's full test suite.
# Requires a working docker & docker-compose installation -- You can run just the unit tests
# without docker by running vendor/bin/phpunit --testsuite "Environment-Independent Tests"
# You can trigger a code coverage report to be generated by passing a --coverage option.
# If --coverage is enabled, it will be written to /tmp/curator-clover.xml.
# Generate a file for docker-compose...
DCFILE='.docker-compose_generated.yml'
/usr/bin/env php './build/generate_docker-compose.php' "$@"
docker-compose -f "$DCFILE" up
echo ""
echo "Run summary:"
docker-compose -f "$DCFILE" ps -q | xargs docker inspect -f '{{ .Name }} exited with code {{ .State.ExitCode }}'
failed_containers=`docker-compose -f "$DCFILE" ps -q | xargs docker inspect -f '{{ .State.ExitCode }}' | grep -v '^0$' | wc -l`
docker-compose -f "$DCFILE" rm -f
if [ $failed_containers -eq '0' ]
then
echo
echo " *** Tests passed against all versions. ***"
exit 0
else
echo ""
>&2 echo "Tests failed in $failed_containers container(s)."
>&2 echo "See complete output above for details."
exit 1
fi