Admin - Parallelize TF test runs in CI (#4177)

This commit is contained in:
Bert Blommers 2021-08-15 12:03:23 +01:00 committed by GitHub
parent 7397b8c129
commit c5b63693b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -203,8 +203,10 @@ jobs:
runs-on: ubuntu-latest
needs: terraformcache
strategy:
fail-fast: false
matrix:
python-version: [ 3.8 ]
part: ["aa", "ab", "ac"]
steps:
- uses: actions/checkout@v2
@ -231,10 +233,17 @@ jobs:
python setup.py sdist
docker run --rm -t --name motoserver -e TEST_SERVER_MODE=true -e MOTO_PORT=4566 -e AWS_SECRET_ACCESS_KEY=server_secret -e AWS_ACCESS_KEY_ID=server_key -v `pwd`:/moto -p 4566:4566 -v /var/run/docker.sock:/var/run/docker.sock python:3.7-buster /moto/travis_moto_server.sh &
MOTO_PORT=4566 python wait_for.py
# Poor man's parallelization
# Running them sequentially takes to much time
# And using the build in parallel-argument does not help with reducing runtime
# So we simply split the list of tests, and ask our CI for separate VM's to run them in parallel
- name: Get list of tests
run: |
split -n l/3 tests/terraform-tests.success.txt tf-split-
- name: Run Terraform Tests
run: |
cd moto-terraform-tests
AWS_DEFAULT_REGION=us-east-1 AWS_ALTERNATE_REGION=eu-west-1 bin/run-tests -t -i ../tests/terraform-tests.success.txt -e ../tests/terraform-tests.failures.txt
AWS_DEFAULT_REGION=us-east-1 AWS_ALTERNATE_REGION=eu-west-1 bin/run-tests -t -i ../tf-split-${{ matrix.part }} -e ../tests/terraform-tests.failures.txt
cd ..
- name: "Create report"
run: |