From e78beae6ea023d1d2db0800f755aadcc33388ce1 Mon Sep 17 00:00:00 2001 From: Markus Scheidgen <markus.scheidgen@gmail.com> Date: Fri, 23 Nov 2018 15:29:24 +0100 Subject: [PATCH] Added integration test to CI. --- .gitlab-ci.yml | 38 ++++++++++++++++++++++++++++++ integration/build_coe_container.sh | 14 +++++++++-- integration/test_integration.sh | 15 ++++++++---- 3 files changed, 61 insertions(+), 6 deletions(-) mode change 100644 => 100755 integration/test_integration.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 699bed2422..9bef133148 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -12,6 +12,7 @@ image: youpy/docker-compose-git stages: - build - test + - integration - release - deploy @@ -87,6 +88,43 @@ tests: except: - /^dev-.*$/ +integration-tests: + stage: integration + services: + - postgres:latest + - mongo:latest + # this will cause a warning, as the gitlab ci runner health check will test the wrong + # port on rabbitmq container: + # https://gitlab.com/gitlab-org/gitlab-runner/issues/3163 + - rabbitmq + - name: docker.elastic.co/elasticsearch/elasticsearch:6.3.2 + alias: elastic + # fix issue with running elastic in gitlab ci runner: + # https://gitlab.com/gitlab-org/gitlab-ce/issues/42214 + command: [ "bin/elasticsearch", "-Ediscovery.type=single-node" ] + - name: $TEST_IMAGE + alias: api + command: nomad run api + - name: $TEST_IMAGE + alias: worker + command: nomad run worker + variables: + POSTGRES_DB: nomad + POSTGRES_USER: postgres + POSTGRES_PASSWORD: nomad + RABBITMQ_ERLANG_COOKIE: SWQOKODSQALRPCLNMEQG + RABBITMQ_DEFAULT_USER: rabbitmq + RABBITMQ_DEFAULT_PASS: rabbitmq + RABBITMQ_DEFAULT_VHOST: / + NOMAD_COE_REPO_DB_HOST: postgres + NOMAD_RABBITMQ_HOST: rabbitmq + NOMAD_ELASTIC_HOST: elastic + NOMAD_MONGO_HOST: mongo + script: + - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN gitlab-registry.mpcdf.mpg.de + - integration/test_integration.sh + except: + - /^dev-.*$/ release: stage: release diff --git a/integration/build_coe_container.sh b/integration/build_coe_container.sh index e006928162..ac6f1003de 100755 --- a/integration/build_coe_container.sh +++ b/integration/build_coe_container.sh @@ -1,5 +1,15 @@ #!/bin/sh +set -e + +echo "log into docker registry..." +docker login gitlab-registry.mpcdf.mpg.de -u $1 -p $2 + +echo "building images..." cd .dependencies/nomad-lab-base -sbt docker repoTool -sbt docker repoWebservice \ No newline at end of file +sbt "project repoTool" docker +sbt "project repoWebservice" docker + +echo "pushing images..." +docker push gitlab-registry.mpcdf.mpg.de/nomad-lab/nomad-fair/coe-repotool +docker push gitlab-registry.mpcdf.mpg.de/nomad-lab/nomad-fair/coe-repowebservice \ No newline at end of file diff --git a/integration/test_integration.sh b/integration/test_integration.sh old mode 100644 new mode 100755 index a7f80109dc..3a274d22ce --- a/integration/test_integration.sh +++ b/integration/test_integration.sh @@ -1,11 +1,18 @@ +#!/bin/sh +set -e + +nomad="docker run gitlab-registry.mpcdf.mpg.de/nomad-lab/nomad-fair:test nomad -p 8000 -h api" +repo_tool="docker run gitlab-registry.mpcdf.mpg.de/nomad-lab/nomad-fair/coe-repotool:latest" +repo_webservice="docker run gitlab-registry.mpcdf.mpg.de/nomad-lab/nomad-fair/coe-repowebservice:latest" + # import example calculations -nomad upload --unstage tests/data/proc/examles_vasp.zip +$nomad upload tests/data/proc/examles_vasp.zip # create a new index with coe repoTool -docker run nomad/coe-repotool:latest +$repo_tool newIndex --indexName=repo_index --indexNameTopics=repo_topics # start coe repoServer -docker run nomad/coe-repowebservice:latest +# docker run nomad/coe-repowebservice:latest # try to search for new calculations -curl localhost:8111/... \ No newline at end of file +# curl localhost:8111/... \ No newline at end of file -- GitLab