Skip to content

Commit

Permalink
Parallelise integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
RushiT0122 committed May 3, 2024
1 parent 8cb2a43 commit 5b691a9
Showing 1 changed file with 91 additions and 20 deletions.
111 changes: 91 additions & 20 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
version: 2
jobs:
build:
version: 2.1
orbs:
slack: circleci/[email protected]

executors:
docker-executor:
docker:
- image: 218546966473.dkr.ecr.us-east-1.amazonaws.com/circle-ci:stitch-tap-tester

jobs:
build:
executor: docker-executor
steps:
- run: echo "CI Done"

ensure_env:
executor: docker-executor
steps:
- checkout
- run:
Expand All @@ -12,39 +24,98 @@ jobs:
source /usr/local/share/virtualenvs/tap-mambu/bin/activate
pip install -U 'pip<19.2' 'setuptools<51.0.0'
pip install .[dev]
- add_ssh_keys
- run:
name: 'JSON Validator'
command: |
source /usr/local/share/virtualenvs/tap-tester/bin/activate
stitch-validate-json tap_mambu/helpers/schemas/*.json
aws s3 cp s3://com-stitchdata-dev-deployment-assets/environments/tap-tester/tap_tester_sandbox /usr/local/share/virtualenvs/dev_env.sh
- slack/notify-on-failure:
only_for_branches: master
- persist_to_workspace:
root: /usr/local/share/virtualenvs
paths:
- tap-mambu
- dev_env.sh

run_unit_tests:
executor: docker-executor
steps:
- checkout
- attach_workspace:
at: /usr/local/share/virtualenvs
- run:
when: always
name: 'Unit Tests'
command: |
source /usr/local/share/virtualenvs/tap-mambu/bin/activate
pytest tests/unittests
- store_test_results:
path: test_output/report.xml
- store_artifacts:
path: htmlcov
- run:
name: 'Integration Tests'
name: 'JSON Validator'
command: |
aws s3 cp s3://com-stitchdata-dev-deployment-assets/environments/tap-tester/tap_tester_sandbox dev_env.sh
source dev_env.sh
source /usr/local/share/virtualenvs/tap-tester/bin/activate
run-test --tap=tap-mambu tests
stitch-validate-json tap_mambu/schemas/*.json
run_integration_tests:
executor: docker-executor
parallelism: 5
steps:
- checkout
- attach_workspace:
at: /usr/local/share/virtualenvs
- run:
name: 'Run Integration Tests'
no_output_timeout: 30m
command: |
source /usr/local/share/virtualenvs/dev_env.sh
mkdir /tmp/${CIRCLE_PROJECT_REPONAME}
export STITCH_CONFIG_DIR=/tmp/${CIRCLE_PROJECT_REPONAME}
source /usr/local/share/virtualenvs/tap-tester/bin/activate
circleci tests glob "tests/test_*.py" | circleci tests split > ./tests-to-run
if [ -s ./tests-to-run ]; then
for test_file in $(cat ./tests-to-run)
do
echo $test_file > $STITCH_CONFIG_DIR/tap_test.txt
run-test --tap=${CIRCLE_PROJECT_REPONAME} $test_file
done
fi
- slack/notify-on-failure:
only_for_branches: master
- store_artifacts:
path: /tmp/tap-mambu

workflows:
version: 2
commit:
commit: &commit_jobs
jobs:
- ensure_env:
context:
- circleci-user
- tier-1-tap-user
- run_unit_tests:
context:
- circleci-user
- tier-1-tap-user
requires:
- ensure_env
- run_integration_tests:
context:
- circleci-user
- tier-1-tap-user
requires:
- ensure_env
- build:
context: circleci-user
context:
- circleci-user
- tier-1-tap-user
requires:
- run_pylint
- run_unit_tests
- run_integration_tests
build_daily:
<<: *commit_jobs
triggers:
- schedule:
cron: "0 0 * * *"
cron: "0 1 * * *"
filters:
branches:
only:
- master
jobs:
- build:
context: circleci-user

0 comments on commit 5b691a9

Please sign in to comment.