Skip to content

Commit

Permalink
[TASK] runTests.sh: Acceptance tests with mysql and postgres
Browse files Browse the repository at this point in the history
Allow mysql & postgres for acceptance tests in
addition to default mariadb:

* Build/Script/runTests.sh -s acceptance -d mysql
* Build/Script/runTests.sh -s acceptance -d postgres

Change-Id: If65f1d8d8b4443107d655948ce87af4390d9681f
Resolves: #93405
Releases: master, 10.4, 9.5
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/67625
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
  • Loading branch information
lolli42 committed Feb 1, 2021
1 parent a6ecc6c commit 1963ee5
Show file tree
Hide file tree
Showing 2 changed files with 124 additions and 4 deletions.
31 changes: 27 additions & 4 deletions Build/Scripts/runTests.sh
Expand Up @@ -102,7 +102,7 @@ Options:
- pdo_sqlsrv
-d <mariadb|mysql|mssql|postgres|sqlite>
Only with -s install|functional
Only with -s install|functional|acceptance
Specifies on which DBMS tests are performed
- mariadb (default): use mariadb
- mysql: use MySQL server
Expand Down Expand Up @@ -366,9 +366,30 @@ case ${TEST_SUITE} in
if [ ${CHUNKS} -gt 1 ]; then
docker-compose run acceptance_split
fi
docker-compose run prepare_acceptance_backend_mariadb
docker-compose run acceptance_backend_mariadb
SUITE_EXIT_CODE=$?
case ${DBMS} in
mysql)
[[ ! -z "$DATABASE_DRIVER" ]] && echo "Using driver: ${DATABASE_DRIVER}"
docker-compose run prepare_acceptance_backend_mysql
docker-compose run acceptance_backend_mysql
SUITE_EXIT_CODE=$?
;;
mariadb)
[[ ! -z "$DATABASE_DRIVER" ]] && echo "Using driver: ${DATABASE_DRIVER}"
docker-compose run prepare_acceptance_backend_mariadb
docker-compose run acceptance_backend_mariadb
SUITE_EXIT_CODE=$?
;;
postgres)
docker-compose run prepare_acceptance_backend_postgres
docker-compose run acceptance_backend_postgres
SUITE_EXIT_CODE=$?
;;
*)
echo "Acceptance tests don't run with DBMS ${DBMS}" >&2
echo >&2
echo "call \".Build/Scripts/runTests.sh -h\" to display help and valid options" >&2
exit 1
esac
docker-compose down
;;
buildCss)
Expand Down Expand Up @@ -547,11 +568,13 @@ case ${TEST_SUITE} in
setUpDockerComposeDotEnv
case ${DBMS} in
mysql)
[[ ! -z "$DATABASE_DRIVER" ]] && echo "Using driver: ${DATABASE_DRIVER}"
docker-compose run prepare_acceptance_install_mysql
docker-compose run acceptance_install_mysql
SUITE_EXIT_CODE=$?
;;
mariadb)
[[ ! -z "$DATABASE_DRIVER" ]] && echo "Using driver: ${DATABASE_DRIVER}"
docker-compose run prepare_acceptance_install_mariadb
docker-compose run acceptance_install_mariadb
SUITE_EXIT_CODE=$?
Expand Down
97 changes: 97 additions & 0 deletions Build/testing-docker/local/docker-compose.yml
Expand Up @@ -101,6 +101,103 @@ services:
$${COMMAND}
"
prepare_acceptance_backend_mysql:
image: alpine:3.8
links:
- mysql
- chrome
- web
command: >
/bin/sh -c "
if [ ${SCRIPT_VERBOSE} -eq 1 ]; then
set -x
fi
echo Waiting for database start...;
while ! nc -z mysql 3306; do
sleep 1;
done;
echo Database is up;
"
acceptance_backend_mysql:
image: typo3/core-testing-${DOCKER_PHP_IMAGE}:latest
user: ${HOST_UID}
environment:
typo3DatabaseName: func_test
typo3DatabaseUsername: root
typo3DatabasePassword: funcp
typo3DatabaseHost: mysql
volumes:
- ${CORE_ROOT}:${CORE_ROOT}
- ${HOST_HOME}:${HOST_HOME}
- /etc/passwd:/etc/passwd:ro
- /etc/group:/etc/group:ro
working_dir: ${CORE_ROOT}
command: >
/bin/sh -c "
if [ ${SCRIPT_VERBOSE} -eq 1 ]; then
set -x
fi
php -v | grep '^PHP'
if [ ${CHUNKS} -gt 0 ]; then
echo \"Running chunk ${THISCHUNK}\"
COMMAND=\"bin/codecept run Backend -d -g AcceptanceTests-Job-${THISCHUNK} -c typo3/sysext/core/Tests/codeception.yml ${TEST_FILE} --xml reports.xml --html reports.html\"
else
COMMAND=\"bin/codecept run Backend -d -c typo3/sysext/core/Tests/codeception.yml ${TEST_FILE} --xml reports.xml --html reports.html\"
fi
mkdir -p typo3temp/var/tests/
$${COMMAND}
"
prepare_acceptance_backend_postgres:
image: alpine:3.8
links:
- postgres
- chrome
- web
command: >
/bin/sh -c "
if [ ${SCRIPT_VERBOSE} -eq 1 ]; then
set -x
fi
echo Waiting for database start...;
while ! nc -z postgres 5432; do
sleep 1;
done;
echo Database is up;
"
acceptance_backend_postgres:
image: typo3/core-testing-${DOCKER_PHP_IMAGE}:latest
user: ${HOST_UID}
volumes:
- ${CORE_ROOT}:${CORE_ROOT}
- ${HOST_HOME}:${HOST_HOME}
- /etc/passwd:/etc/passwd:ro
- /etc/group:/etc/group:ro
environment:
typo3DatabaseDriver: pdo_pgsql
typo3DatabaseName: bamboo
typo3DatabaseUsername: funcu
typo3DatabaseHost: postgres
typo3DatabasePassword: funcp
typo3TestingRedisHost: redis4
typo3TestingMemcachedHost: memcached1-5
working_dir: ${CORE_ROOT}
command: >
/bin/sh -c "
if [ ${SCRIPT_VERBOSE} -eq 1 ]; then
set -x
fi
php -v | grep '^PHP'
if [ ${CHUNKS} -gt 0 ]; then
echo \"Running chunk ${THISCHUNK}\"
COMMAND=\"bin/codecept run Backend -d -g AcceptanceTests-Job-${THISCHUNK} -c typo3/sysext/core/Tests/codeception.yml ${TEST_FILE} --xml reports.xml --html reports.html\"
else
COMMAND=\"bin/codecept run Backend -d -c typo3/sysext/core/Tests/codeception.yml ${TEST_FILE} --xml reports.xml --html reports.html\"
fi
mkdir -p typo3temp/var/tests/
$${COMMAND}
"
prepare_acceptance_install_mysql:
image: alpine:3.8
links:
Expand Down

0 comments on commit 1963ee5

Please sign in to comment.