From 86f418a288c83714782f4590a695dd6b8836e377 Mon Sep 17 00:00:00 2001 From: Antoine Legrand <2t.antoine@gmail.com> Date: Fri, 28 Jul 2017 17:13:52 +0200 Subject: [PATCH] Add docker-cli e2e tests --- .gitlab-ci.jsonnet | 24 +++++++++++++++-- .gitlab-ci.yml | 47 ++++++++++++++++++++++++++++++++-- .gitlab-ci/base_jobs.libsonnet | 1 + 3 files changed, 68 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.jsonnet b/.gitlab-ci.jsonnet index 2f761d8f2..e39933e8f 100644 --- a/.gitlab-ci.jsonnet +++ b/.gitlab-ci.jsonnet @@ -9,8 +9,8 @@ local stages_list = [ 'docker_base', 'docker_build', 'deploy_preview', - 'integration', 'tests', + 'integration', 'docker_release', 'deploy_staging', 'teardown', @@ -107,7 +107,7 @@ local jobs = { 'protractor_e2e': integration_test { initDb:: true, variables+: {"APP_HOST": "http://localhost:80"}, - services+: ["selenium/standalone-chrome:3.4.0"], + services+: [{name: "selenium/standalone-chrome:3.4.0"}], before_script+: [ "curl -sL https://deb.nodesource.com/setup_8.x | bash -", "apt-get install -y nodejs", @@ -130,6 +130,26 @@ local jobs = { allow_failure: true, }, + 'docker_e2e': integration_test { + initDb:: true, + image: {name: "docker"}, + services+: [{name: "docker:dind"}], + variables+: { + DOCKER_DRIVER: "overlay2", + DOCKER_HOST: "tcp://localhost:2375" + }, + before_script: [], + script+: [ + "docker login localhost:80 -u devtable -p password", + "docker pull nginx", + "docker tag nginx localhost:80/devtable/nginx", + "docker push localhost:80/devtable/nginx", + "sleep 1", + "docker pull localhost:80/devtable/nginx", + ], + allow_failure: true, + }, + // Unit-tests with real databases local db_stage = { stage: stages.tests }, local dbname = 'quay', diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8cf5d4c29..18f69eb0f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -31,6 +31,7 @@ appr_e2e: POSTGRES_USER: quay PYTHONPATH: . QUAYDIR: /quay-registry + QUAY_OVERRIDE_CONFIG: '{"SERVER_HOSTNAME": "localhost:80"}' SKIP_DB_SCHEMA: 'true' TEST: 'true' TEST_DATABASE_URI: postgresql://quay:quay@localhost/quay @@ -136,6 +137,47 @@ deploy-staging: variables: K8S_NAMESPACE: ci-staging QUAY_DOMAIN: quay-staging.k8s.devtable.com +docker_e2e: + allow_failure: true + before_script: [] + image: + name: docker + script: + - sleep 150 + - docker login localhost:80 -u devtable -p password + - docker pull nginx + - docker tag nginx localhost:80/devtable/nginx + - docker push localhost:80/devtable/nginx + - sleep 1 + - docker pull localhost:80/devtable/nginx + services: + - name: postgres:9.6 + - alias: quay + name: quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG} + - alias: db-init + command: + - /bin/sh + - -c + - sleep 30&& /quay-registry/venv/bin/python initdb.py&& sleep 3600 + name: quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG} + - name: docker:dind + stage: integration + tags: + - kubernetes + variables: + APP_HOST: localhost:80 + DB_URI: postgresql://quay:quay@localhost/quay + DOCKER_DRIVER: overlay2 + DOCKER_HOST: tcp://localhost:2375 + GIT_STRATEGY: none + POSTGRES_PASSWORD: quay + POSTGRES_USER: quay + PYTHONPATH: . + QUAYDIR: /quay-registry + QUAY_OVERRIDE_CONFIG: '{"SERVER_HOSTNAME": "localhost:80"}' + SKIP_DB_SCHEMA: 'true' + TEST: 'true' + TEST_DATABASE_URI: postgresql://quay:quay@localhost/quay karma-tests: before_script: - cd $QUAYDIR @@ -227,7 +269,7 @@ protractor_e2e: - -c - sleep 30&& /quay-registry/venv/bin/python initdb.py&& sleep 3600 name: quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG} - - selenium/standalone-chrome:3.4.0 + - name: selenium/standalone-chrome:3.4.0 stage: integration tags: - kubernetes @@ -239,6 +281,7 @@ protractor_e2e: POSTGRES_USER: quay PYTHONPATH: . QUAYDIR: /quay-registry + QUAY_OVERRIDE_CONFIG: '{"SERVER_HOSTNAME": "localhost:80"}' SKIP_DB_SCHEMA: 'true' TEST: 'true' TEST_DATABASE_URI: postgresql://quay:quay@localhost/quay @@ -262,8 +305,8 @@ stages: - docker_base - docker_build - deploy_preview -- integration - tests +- integration - docker_release - deploy_staging - teardown diff --git a/.gitlab-ci/base_jobs.libsonnet b/.gitlab-ci/base_jobs.libsonnet index e461f3040..a65ef9c8d 100644 --- a/.gitlab-ci/base_jobs.libsonnet +++ b/.gitlab-ci/base_jobs.libsonnet @@ -124,6 +124,7 @@ function(vars={}) POSTGRES_USER: "quay", SKIP_DB_SCHEMA: 'true', TEST_DATABASE_URI: self['DB_URI'], + QUAY_OVERRIDE_CONFIG: '' + {"SERVER_HOSTNAME": "localhost:80"}, DB_URI: 'postgresql://quay:quay@localhost/quay' }, },