Skip to content
Snippets Groups Projects

CI pipeline for mysql unit tests

Merged Daniel Hornung requested to merge f-mysql-test into dev
3 unresolved threads
2 files
+ 2
3
Compare changes
  • Side-by-side
  • Inline

Files

+ 60
29
@@ -19,8 +19,6 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
services:
- mariadb:10.4
variables:
DEPLOY_REF: dev
CI_REGISTRY_IMAGE: $CI_REGISTRY/caosdb/src/caosdb-mysqlbackend/testenv:latest
@@ -32,31 +30,7 @@ stages:
- test
- deploy
# Trigger building of server image and integration tests
Please register or sign in to reply
trigger_build:
tags: [ docker ]
stage: deploy
script:
- /usr/bin/curl -X POST
-F token=$CI_JOB_TOKEN
-F "variables[F_BRANCH]=$CI_COMMIT_REF_NAME"
-F "variables[MYSQLBACKEND]=$CI_COMMIT_REF_NAME"
-F "variables[TriggerdBy]=MYSQLBACKEND"
-F "variables[TriggerdByHash]=$CI_COMMIT_SHORT_SHA"
-F ref=$DEPLOY_REF https://gitlab.indiscale.com/api/v4/projects/14/trigger/pipeline
unittests:
tags: [ docker ]
stage: test
script:
- cp config.defaults .config
- echo 'DATABASE_USER_HOST_LIST="%,"' >> .config
- echo "MYSQL_USER_PASSWORD=$MYSQL_ROOT_PASSWORD" >> .config
- echo "MYSQL_HOST=mariadb" >> .config
- sleep 10
- make install
- ./utils/make_db restore_db tests/example.dump.sql
- ./tests/test_utils.sh
######## Setup ########
# Build a docker image in which tests for this repository can run
build-testenv:
    • By the way, we only want to test if different backends work, the intent of this MR is not to find out if different SQL command line clients can run the tests. So one single testenv image with the MariaDB client should be sufficient.

Please register or sign in to reply
@@ -75,6 +49,64 @@ build-testenv:
-t $CI_REGISTRY_IMAGE .
- docker push $CI_REGISTRY_IMAGE
######## Test ########
# Run the unit tests with MariaDB
unittests-mariadb:
tags: [ docker ]
stage: test
services:
- mariadb:10.4
script:
- make pipeline-test SQL_HOST=mariadb
# Run the unit tests with MySQL 8
unittests-mysql-8:
tags: [ docker ]
stage: test
# Should not stop the pipeline from continuing.
allow_failure: true
services:
- name: mysql:8.0
command: ["--default-authentication-plugin=mysql_native_password"]
script:
- make pipeline-test SQL_HOST=mysql
# Run the unit tests with MySQL 5
unittests-mysql-5:
tags: [ docker ]
stage: test
# Should not stop the pipeline from continuing.
allow_failure: true
services:
- name: mysql:5.7
command: ["--default-authentication-plugin=mysql_native_password"]
script:
# remove autotap because the checks of (autogenerated) names of constraints
# and the checks of column default values don't work with mysql
- rm tests/test_autotap.sql
- make pipeline-test SQL_HOST=mysql
######## Deploy ########
# Trigger building of server image and integration tests
trigger_build:
tags: [ docker ]
stage: deploy
script:
- /usr/bin/curl -X POST
-F token=$CI_JOB_TOKEN
-F "variables[F_BRANCH]=$CI_COMMIT_REF_NAME"
-F "variables[MYSQLBACKEND]=$CI_COMMIT_REF_NAME"
-F "variables[TriggerdBy]=MYSQLBACKEND"
-F "variables[TriggerdByHash]=$CI_COMMIT_SHORT_SHA"
-F ref=$DEPLOY_REF https://gitlab.indiscale.com/api/v4/projects/14/trigger/pipeline
# Build the sphinx documentation and make it ready for deployment by Gitlab Pages
# Special job for serving a static website. See https://docs.gitlab.com/ee/ci/yaml/README.html#pages
pages_prepare: &pages_prepare
@@ -95,4 +127,3 @@ pages:
only:
refs:
- main
Loading