Uses git branch for backend and pb containers for e2e testing

This commit is contained in:
Aaron Louie 2020-05-11 13:46:26 -04:00
parent 2b9e99a3db
commit 99ac282dc2
4 changed files with 28 additions and 4 deletions

View File

@ -14,6 +14,15 @@ services:
- docker - docker
- xvfb - xvfb
before_install:
- |
branches=('dev' 'testing' 'demo' 'training' 'staging')
if [[ " ${arr[@]} " =~ " ${TRAVIS_BRANCH} " ]]; then
export E2E_TAG="$TRAVIS_BRANCH"
else
export E2E_TAG="latest"
fi
install: install:
- npm install - npm install

View File

@ -20,19 +20,20 @@ services:
container_name: backend container_name: backend
depends_on: depends_on:
- db - db
image: sartography/cr-connect-workflow image: sartography/cr-connect-workflow:$E2E_TAG
volumes: volumes:
- ./flask-config/config.py:/crc-workflow/instance/config.py - ./flask-config/config.py:/crc-workflow/instance/config.py
environment: environment:
- FLASK_APP=./crc/__init__.py - FLASK_APP=./crc/__init__.py
- RESET_DB=true - RESET_DB=true
- LDAP_URL=ldap
ports: ports:
- "5000:5000" - "5000:5000"
command: ./wait-for-it.sh db:5432 -t 0 -- ./docker_run.sh command: ./wait-for-it.sh db:5432 -t 0 -- ./docker_run.sh
pb: pb:
container_name: pb container_name: pb
image: sartography/protocol-builder-mock image: sartography/protocol-builder-mock:$E2E_TAG
volumes: volumes:
- ./flask-config/config_pb.py:/protocol-builder-mock/instance/config.py - ./flask-config/config_pb.py:/protocol-builder-mock/instance/config.py
environment: environment:
@ -41,3 +42,8 @@ services:
- "5001:5001" - "5001:5001"
command: ./wait-for-it.sh db:5432 -t 0 -- ./docker_run.sh command: ./wait-for-it.sh db:5432 -t 0 -- ./docker_run.sh
ldap:
container_name: ldap
image: tuxmonteiro/ldap-mock
ports:
- "3890"

View File

@ -6,4 +6,10 @@ CORS_ENABLED = False
DEVELOPMENT = True DEVELOPMENT = True
SQLALCHEMY_DATABASE_URI = "postgresql://crc_user:crc_pass@db:5432/crc_dev" SQLALCHEMY_DATABASE_URI = "postgresql://crc_user:crc_pass@db:5432/crc_dev"
# %s/%i placeholders expected for uva_id and study_id in various calls.
PB_USER_STUDIES_URL = "http://pb:5001/pb/user_studies?uva_id=%s"
PB_INVESTIGATORS_URL = "http://pb:5001/pb/investigators?studyid=%i"
PB_REQUIRED_DOCS_URL = "http://pb:5001/pb/required_docs?studyid=%i"
PB_STUDY_DETAILS_URL = "http://pb:5001/pb/study?studyid=%i"
print('\n\n*** USING INSTANCE CONFIG ***\n\n') print('\n\n*** USING INSTANCE CONFIG ***\n\n')

View File

@ -13,11 +13,14 @@
"lint": "ng lint", "lint": "ng lint",
"e2e": "./node_modules/protractor/bin/webdriver-manager update && ng e2e", "e2e": "./node_modules/protractor/bin/webdriver-manager update && ng e2e",
"e2e:with-wf": "npm run e2e-wf && ng e2e && npm run e2e-wf:stop && npm run e2e-wf:clean", "e2e:with-wf": "npm run e2e-wf && ng e2e && npm run e2e-wf:stop && npm run e2e-wf:clean",
"e2e-wf:stop": "docker stop db || true && docker stop backend || true", "e2e-wf:stop": "docker stop db || true && docker stop backend || true && docker stop pb || true",
"e2e-wf:clean": "docker system prune -f && cd docker && docker-compose rm -f -v -s && cd ..", "e2e-wf:clean": "docker system prune -f && cd docker && docker-compose rm -f -v -s && cd ..",
"e2e-wf:build": "cd docker && docker-compose pull && docker-compose build --no-cache && cd ..", "e2e-wf:build": "cd docker && docker-compose pull && docker-compose build --no-cache && cd ..",
"e2e-wf:start": "cd docker && docker-compose up -d && cd ..", "e2e-wf:start": "cd docker && docker-compose up -d && cd ..",
"e2e-wf": "npm run e2e-wf:stop && npm run e2e-wf:clean && npm run e2e-wf:build && npm run e2e-wf:start", "e2e-wf:db-upgrade": "docker exec -it backend pipenv run flask db upgrade",
"e2e-wf:db-setup": "docker exec -it backend pipenv run flask load-example-data",
"e2e-wf:pb-setup": "docker exec -it pb pipenv run flask db upgrade",
"e2e-wf": "npm run e2e-wf:stop && npm run e2e-wf:clean && npm run e2e-wf:build && npm run e2e-wf:start && npm run e2e-wf:db-upgrade && npm run e2e-wf:db-setup && npm run e2e-wf:pb-setup",
"ci": "npm run lint && npm run test:coverage && npm run e2e:with-wf && sonar-scanner" "ci": "npm run lint && npm run test:coverage && npm run e2e:with-wf && sonar-scanner"
}, },
"private": true, "private": true,