feat(test): update e2e setup

pull/3314/head
Anthony Lapenna 2019-10-29 11:38:38 +13:00
parent c6e9d8e616
commit 36de0aee7b
2 changed files with 71 additions and 1 deletions

View File

@ -5,15 +5,62 @@ services:
container_name: e2e-portainer
volumes:
- /var/run/docker.sock:/var/run/docker.sock
networks:
- e2e-ci
cypress:
image: cypress/included:3.5.0
container_name: e2e-cypress
# command: --record --browser chrome
depends_on:
- portainer
working_dir: /e2e
environment:
- CYPRESS_baseUrl=http://e2e-portainer:9000
CYPRESS_baseUrl: http://e2e-portainer:9000
# CYPRESS_RECORD_KEY:
volumes:
- ./cypress:/e2e/cypress
- ./cypress.json:/e2e/cypress.json
networks:
- e2e-ci
manager1:
image: docker:dind
privileged: true
environment:
DOCKER_TLS_CERTDIR:
hostname: manager1
networks:
- e2e-ci
depends_on:
- manager2
- worker1
- worker2
manager2:
image: docker:dind
privileged: true
environment:
DOCKER_TLS_CERTDIR:
hostname: manager2
networks:
- e2e-ci
worker1:
image: docker:dind
privileged: true
environment:
DOCKER_TLS_CERTDIR:
hostname: worker1
networks:
- e2e-ci
worker2:
image: docker:dind
privileged: true
environment:
DOCKER_TLS_CERTDIR:
hostname: worker2
networks:
- e2e-ci
networks:
e2e-ci:
driver: bridge

23
test/e2e/run-e2e.sh Executable file
View File

@ -0,0 +1,23 @@
#!/bin/sh
exec_in() { docker-compose exec -T $@; }
# Up all dinds nodes
docker-compose up -d manager1 manager2 worker1 worker2
# Manager1 init
exec_in manager1 docker swarm init
TOKEN_WORKER="$(exec_in manager1 docker swarm join-token -q worker)"
TOKEN_MANAGER="$(exec_in manager1 docker swarm join-token -q manager)"
# Manager2 join
exec_in manager2 docker swarm join --token $TOKEN_MANAGER manager1:2377
# Worker1 join
exec_in worker1 docker swarm join --token $TOKEN_WORKER manager1:2377
# Worker2 join
exec_in worker2 docker swarm join --token $TOKEN_WORKER manager1:2377
# Up portainer
docker-compose up --exit-code-from cypress