diff --git a/.gitlab-ci.jsonnet b/.gitlab-ci.jsonnet index 136ba2d6d..27241dd07 100644 --- a/.gitlab-ci.jsonnet +++ b/.gitlab-ci.jsonnet @@ -97,6 +97,22 @@ local jobs = { 'yarn test' ] }, + // Integration API + local integration_test = baseJob.EndToEndTest { + stage: stages.unit_tests + }, + + 'demo_e2e': integration_test { + script: [ + "python initdb.py", + "sleep 30", + "curl localhost:80/cnr/version", + "sleep 30", + "curl localhost:80", + "sleep 30", + "curl localhost:80/status", + ] + }, // Unit-tests with real databases local db_stage = { stage: stages.unit_tests }, local dbname = 'quay', diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b235a8613..18ffed59f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -51,6 +51,37 @@ container-release: variables: DOCKER_DRIVER: overlay DOCKER_HOST: tcp://docker-host.gitlab-runner.svc.cluster.local:2375 +demo_e2e: + before_script: + - cd $QUAYDIR + - source $QUAYDIR/venv/bin/activate + - sleep 30 + - alembic upgrade head + image: quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG} + script: + - python initdb.py + - sleep 30 + - curl localhost:80/cnr/version + - sleep 30 + - curl localhost:80 + - sleep 30 + - curl localhost:80/status + services: + - postgres:9.6 + - quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG} + stage: unit_tests + tags: + - kubernetes + variables: + DB_URI: postgresql://quay:quay@localhost/quay + GIT_STRATEGY: none + POSTGRES_PASSWORD: quay + POSTGRES_USER: quay + PYTHONPATH: . + QUAYDIR: /quay-registry + SKIP_DB_SCHEMA: 'true' + TEST: 'true' + TEST_DATABASE_URI: postgresql://quay:quay@localhost/quay deploy-preview: before_script: - appr login -u $DOCKER_USER -p $DOCKER_PASS quay.io diff --git a/.gitlab-ci/base_jobs.libsonnet b/.gitlab-ci/base_jobs.libsonnet index 2fee90d51..c79d6fd50 100644 --- a/.gitlab-ci/base_jobs.libsonnet +++ b/.gitlab-ci/base_jobs.libsonnet @@ -35,7 +35,6 @@ function(vars={}) ], }, - QuayDeploy: { local this = self, local _vars = self.localvars, @@ -99,6 +98,24 @@ function(vars={}) }, before_script: [], script: [], + }, + + EndToEndTest: self.QuayTest { + services: [ + "postgres:9.6", + vars.images.quayci.name, + ], + before_script+: [ + "sleep 30", + "alembic upgrade head", + ], + variables+: { + POSTGRES_PASSWORD: "quay", + POSTGRES_USER: "quay", + SKIP_DB_SCHEMA: 'true', + TEST_DATABASE_URI: self['DB_URI'], + DB_URI: 'postgresql://quay:quay@localhost/quay' + }, }, dbTest(scheme, image, env):: self.QuayTest {