diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 40b093ee4..9322c09ed 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,7 +15,8 @@ jobs: - name: Checkout Terraform Tests repo uses: actions/checkout@v2 with: - repository: bblommers/moto-terraform-tests + repository: localstack/localstack-terraform-test + ref: build path: moto-terraform-tests submodules: 'true' - uses: actions/setup-go@v2 @@ -27,8 +28,10 @@ jobs: uses: actions/cache@v2 with: path: '~/.cache' - key: 'terraformcache' + key: 'terraformcache3' - name: Download + env: + DOWNLOAD_TEST_BIN: 1 if: ${{ steps.terraformcache.outputs.cache-hit != 'true' }} run: | cd moto-terraform-tests @@ -210,7 +213,8 @@ jobs: - name: Checkout Terraform Tests repo uses: actions/checkout@v2 with: - repository: bblommers/moto-terraform-tests + repository: localstack/localstack-terraform-test + ref: build path: moto-terraform-tests submodules: 'true' - name: Set up Python ${{ matrix.python-version }} @@ -221,16 +225,16 @@ jobs: uses: actions/cache@v2 with: path: '~/.cache' - key: 'terraformcache' + key: 'terraformcache3' - name: Start MotoServer run: | python setup.py sdist - docker run --rm -t --name motoserver -e TEST_SERVER_MODE=true -e AWS_SECRET_ACCESS_KEY=server_secret -e AWS_ACCESS_KEY_ID=server_key -v `pwd`:/moto -p 5000:5000 -v /var/run/docker.sock:/var/run/docker.sock python:3.7-buster /moto/travis_moto_server.sh & - python wait_for.py + 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 - name: Run Terraform Tests run: | cd moto-terraform-tests - AWS_DEFAULT_REGION=us-east-1 AWS_ALTERNATE_REGION=eu-west-1 bin/run-tests -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 ../tests/terraform-tests.success.txt -e ../tests/terraform-tests.failures.txt cd .. - name: "Create report" run: | @@ -238,6 +242,12 @@ jobs: bin/create-report bin/create-report-cli cd .. + - name: Archive TF logs + uses: actions/upload-artifact@v2 + with: + name: buildfolder + path: | + moto-terraform-tests/build/* deploy: name: Deploy diff --git a/travis_moto_server.sh b/travis_moto_server.sh index a9ca79eb5..a3233a294 100755 --- a/travis_moto_server.sh +++ b/travis_moto_server.sh @@ -1,4 +1,7 @@ #!/usr/bin/env bash + +export MOTO_PORT=${MOTO_PORT:-5000} + set -e pip install $(ls /moto/dist/moto*.gz)[server,all] -moto_server -H 0.0.0.0 -p 5000 +moto_server -H 0.0.0.0 -p ${MOTO_PORT} diff --git a/wait_for.py b/wait_for.py index 919a5cb73..ac2945eef 100755 --- a/wait_for.py +++ b/wait_for.py @@ -1,3 +1,4 @@ +import os import time try: @@ -18,10 +19,13 @@ except ImportError: start_ts = time.time() -print("Waiting for service to come up") +expected_port = os.environ.get("MOTO_PORT", "5000") +expected_host = "http://localhost:{}/".format(expected_port) +print("Waiting for service to come up on {}".format(expected_host)) while True: try: - urllib.urlopen("http://localhost:5000/", timeout=1) + + urllib.urlopen(expected_host, timeout=1) break except EXCEPTIONS: elapsed_s = time.time() - start_ts