From 3be907b4af0f266a3ab26f401f0f32fe9c18029b Mon Sep 17 00:00:00 2001 From: Vlad Gramuzov Date: Fri, 22 Nov 2024 14:56:57 +0100 Subject: [PATCH 01/46] feat(ci): integrate ci analytics --- .github/workflows/integration-test.yml | 60 ++++++++++++++++++++------ .gitignore | 1 + 2 files changed, 49 insertions(+), 12 deletions(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 2c5c483..0a7553e 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -27,6 +27,20 @@ jobs: - name: Checkout uses: actions/checkout@v4 + - name: Checkout CI Extension + uses: actions/checkout@v4 + with: + token: ${{ secrets.GH_PULL_TOKEN }} + repository: localstack/localstack-ci-extension + path: localstack-ci-extension + + - name: Checkout CI Extension Plugin + uses: actions/checkout@v4 + with: + token: ${{ secrets.GH_PULL_TOKEN }} + repository: localstack/localstack-ci-extension-plugins + path: localstack-ci-extension-plugins + - name: Set up Python 3.11 id: setup-python uses: actions/setup-python@v2 @@ -41,39 +55,61 @@ jobs: - name: Set up Dependencies run: | pip install requests boto3 pytest localstack-sdk-python + pip install localstack-ci-extension-plugins/pytest_plugin + echo "CI_EXTENSION_PATH=$GITHUB_WORKSPACE/localstack-ci-extension" >> $GITHUB_ENV - name: Start LocalStack uses: LocalStack/setup-localstack@v0.2.3 with: image-tag: 'latest' use-pro: 'true' - configuration: LS_LOG=trace + configuration: LS_LOG=trace DEBUG=1 DOCKER_FLAGS="-v ${{ env.CI_EXTENSION_PATH }}:/extensions/ci-extension -e API_ENDPOINT=https://api.staging.aws.localstack.cloud/v1" install-awslocal: 'true' + extension-auto-install: '/extensions/ci-extension' env: + API_ENDPOINT: 'https://api.staging.aws.localstack.cloud/v1' LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }} + LOCALSTACK_PROJECT_ID: ${{ secrets.LOCALSTACK_PROJECT_ID }} + LOCALSTACK_PIPELINE_ID: ${{ secrets.LOCALSTACK_PIPELINE_ID }} - name: Deploy infrastructure run: | + START_TIME=$(date -u +"%Y-%m-%dT%H:%M:%S.%3NZ") bash bin/deploy.sh + END_TIME=$(date -u +"%Y-%m-%dT%H:%M:%S.%3NZ") + curl -X POST http://localhost:4566/_localstack/extensions/ci/steps \ + -H "Content-Type: application/json" \ + -d '{ + "step_id": "deploy", + "name": "Deploy Infrastructure", + "step_type" : "deploy", + "state": "passed", + "time_start": "'"$START_TIME"'", + "time_end": "'"$END_TIME"'" + }' + + START_TIME=$(date -u +"%Y-%m-%dT%H:%M:%S.%3NZ") bash bin/seed.sh + END_TIME=$(date -u +"%Y-%m-%dT%H:%M:%S.%3NZ") + curl -X POST http://localhost:4566/_localstack/extensions/ci/steps \ + -H "Content-Type: application/json" \ + -d '{ + "step_id": "seed", + "name": "Seed Data", + "step_type" : "deploy", + "state": "passed", + "time_start": "'"$START_TIME"'", + "time_end": "'"$END_TIME"'" + }' - - name: Run Integration Tests - env: - AWS_DEFAULT_REGION: us-east-1 - AWS_REGION: us-east-1 - AWS_ACCESS_KEY_ID: test - AWS_SECRET_ACCESS_KEY: test - run: | - pytest tests/test_infra.py - - - name: Run Outages Tests + - name: Run Tests env: AWS_DEFAULT_REGION: us-east-1 AWS_REGION: us-east-1 AWS_ACCESS_KEY_ID: test AWS_SECRET_ACCESS_KEY: test run: | - pytest tests/test_outage.py + pytest tests - name: Show localstack logs if: always() diff --git a/.gitignore b/.gitignore index cd920f5..e1a54cc 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ # Python +.idea .Python build/ develop-eggs/ From 8d4c67af4e769852a9bb3165b054c70c075cec69 Mon Sep 17 00:00:00 2001 From: Vlad Gramuzov Date: Wed, 27 Nov 2024 19:41:36 +0100 Subject: [PATCH 02/46] update test workflow --- .github/workflows/integration-test.yml | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 0a7553e..73fe3d9 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -79,28 +79,28 @@ jobs: END_TIME=$(date -u +"%Y-%m-%dT%H:%M:%S.%3NZ") curl -X POST http://localhost:4566/_localstack/extensions/ci/steps \ -H "Content-Type: application/json" \ - -d '{ + -d '[{ "step_id": "deploy", "name": "Deploy Infrastructure", "step_type" : "deploy", "state": "passed", "time_start": "'"$START_TIME"'", "time_end": "'"$END_TIME"'" - }' + }]' START_TIME=$(date -u +"%Y-%m-%dT%H:%M:%S.%3NZ") bash bin/seed.sh END_TIME=$(date -u +"%Y-%m-%dT%H:%M:%S.%3NZ") curl -X POST http://localhost:4566/_localstack/extensions/ci/steps \ -H "Content-Type: application/json" \ - -d '{ + -d '[{ "step_id": "seed", "name": "Seed Data", "step_type" : "deploy", "state": "passed", "time_start": "'"$START_TIME"'", "time_end": "'"$END_TIME"'" - }' + }]' - name: Run Tests env: @@ -116,19 +116,6 @@ jobs: run: | localstack logs - - name: Send a Slack notification - if: failure() || github.event_name != 'pull_request' - uses: ravsamhq/notify-slack-action@v2 - with: - status: ${{ job.status }} - token: ${{ secrets.GITHUB_TOKEN }} - notification_title: "{workflow} has {status_message}" - message_format: "{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}>" - footer: "Linked Repo <{repo_url}|{repo}> | <{run_url}|View Workflow run>" - notify_when: "failure" - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} - - name: Generate a Diagnostic Report if: failure() run: | From be21a109552da2a6ab8e3e4526cbf1e0da071333 Mon Sep 17 00:00:00 2001 From: Vlad Gramuzov Date: Wed, 27 Nov 2024 20:07:11 +0100 Subject: [PATCH 03/46] update test workflow --- .github/workflows/integration-test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 73fe3d9..e598c63 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -57,6 +57,7 @@ jobs: pip install requests boto3 pytest localstack-sdk-python pip install localstack-ci-extension-plugins/pytest_plugin echo "CI_EXTENSION_PATH=$GITHUB_WORKSPACE/localstack-ci-extension" >> $GITHUB_ENV + ls -la $CI_EXTENSION_PATH - name: Start LocalStack uses: LocalStack/setup-localstack@v0.2.3 From cbad00273d9c6ecf56c7960fd8b341329c247888 Mon Sep 17 00:00:00 2001 From: Vlad Gramuzov Date: Wed, 27 Nov 2024 20:12:19 +0100 Subject: [PATCH 04/46] update test workflow --- .github/workflows/integration-test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index e598c63..a827323 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -57,6 +57,7 @@ jobs: pip install requests boto3 pytest localstack-sdk-python pip install localstack-ci-extension-plugins/pytest_plugin echo "CI_EXTENSION_PATH=$GITHUB_WORKSPACE/localstack-ci-extension" >> $GITHUB_ENV + echo "$CI_EXTENSION_PATH" ls -la $CI_EXTENSION_PATH - name: Start LocalStack From a04c158d29a55546e4a537a85689a8220fb306ca Mon Sep 17 00:00:00 2001 From: Vlad Gramuzov Date: Wed, 27 Nov 2024 20:19:35 +0100 Subject: [PATCH 05/46] update test workflow --- .github/workflows/integration-test.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index a827323..eb54bd9 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -56,16 +56,14 @@ jobs: run: | pip install requests boto3 pytest localstack-sdk-python pip install localstack-ci-extension-plugins/pytest_plugin - echo "CI_EXTENSION_PATH=$GITHUB_WORKSPACE/localstack-ci-extension" >> $GITHUB_ENV - echo "$CI_EXTENSION_PATH" - ls -la $CI_EXTENSION_PATH + mv $GITHUB_WORKSPACE/localstack-ci-extension /extensions/ci-extension - name: Start LocalStack uses: LocalStack/setup-localstack@v0.2.3 with: image-tag: 'latest' use-pro: 'true' - configuration: LS_LOG=trace DEBUG=1 DOCKER_FLAGS="-v ${{ env.CI_EXTENSION_PATH }}:/extensions/ci-extension -e API_ENDPOINT=https://api.staging.aws.localstack.cloud/v1" + configuration: LS_LOG=trace DEBUG=1 DOCKER_FLAGS="-v /extensions/ci-extension:/extensions/ci-extension -e API_ENDPOINT=https://api.staging.aws.localstack.cloud/v1" install-awslocal: 'true' extension-auto-install: '/extensions/ci-extension' env: From 4c58d598ae73c34cb469c01c13092225e89d1fae Mon Sep 17 00:00:00 2001 From: Vlad Gramuzov Date: Wed, 27 Nov 2024 20:20:45 +0100 Subject: [PATCH 06/46] update test workflow --- .github/workflows/integration-test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index eb54bd9..36e097c 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -56,6 +56,7 @@ jobs: run: | pip install requests boto3 pytest localstack-sdk-python pip install localstack-ci-extension-plugins/pytest_plugin + mkdir -p /extensions mv $GITHUB_WORKSPACE/localstack-ci-extension /extensions/ci-extension - name: Start LocalStack From 6e0064d30d4f13fafcc4801a53dea83a452eb957 Mon Sep 17 00:00:00 2001 From: Vlad Gramuzov Date: Wed, 27 Nov 2024 20:27:53 +0100 Subject: [PATCH 07/46] update test workflow --- .github/workflows/integration-test.yml | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 36e097c..1a8a8a8 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -56,22 +56,18 @@ jobs: run: | pip install requests boto3 pytest localstack-sdk-python pip install localstack-ci-extension-plugins/pytest_plugin - mkdir -p /extensions - mv $GITHUB_WORKSPACE/localstack-ci-extension /extensions/ci-extension + pip install localstack - name: Start LocalStack - uses: LocalStack/setup-localstack@v0.2.3 - with: - image-tag: 'latest' - use-pro: 'true' - configuration: LS_LOG=trace DEBUG=1 DOCKER_FLAGS="-v /extensions/ci-extension:/extensions/ci-extension -e API_ENDPOINT=https://api.staging.aws.localstack.cloud/v1" - install-awslocal: 'true' - extension-auto-install: '/extensions/ci-extension' env: + LS_LOG: trace + DEBUG: 1 + DOCKER_FLAGS: -e API_ENDPOINT=https://api.staging.aws.localstack.cloud/v1 API_ENDPOINT: 'https://api.staging.aws.localstack.cloud/v1' LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }} LOCALSTACK_PROJECT_ID: ${{ secrets.LOCALSTACK_PROJECT_ID }} LOCALSTACK_PIPELINE_ID: ${{ secrets.LOCALSTACK_PIPELINE_ID }} + run: localstack start - name: Deploy infrastructure run: | From 97bb8a0de646f52af4b1283e5516398da0ab8b77 Mon Sep 17 00:00:00 2001 From: Vlad Gramuzov Date: Wed, 27 Nov 2024 20:31:32 +0100 Subject: [PATCH 08/46] update test workflow --- .github/workflows/integration-test.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 1a8a8a8..04983b2 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -58,10 +58,15 @@ jobs: pip install localstack-ci-extension-plugins/pytest_plugin pip install localstack + - name: Prepare LocalStack + run: | + localstack extensions dev enable ./localstack-ci-extension + - name: Start LocalStack env: LS_LOG: trace DEBUG: 1 + EXTENSION_DEV_MODE: 1 DOCKER_FLAGS: -e API_ENDPOINT=https://api.staging.aws.localstack.cloud/v1 API_ENDPOINT: 'https://api.staging.aws.localstack.cloud/v1' LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }} From 2e3b436efb27a7bbb1708cf4a68baac3ab1312f2 Mon Sep 17 00:00:00 2001 From: Vlad Gramuzov Date: Wed, 27 Nov 2024 20:33:34 +0100 Subject: [PATCH 09/46] update test workflow --- .github/workflows/integration-test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 04983b2..5c08a1b 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -53,6 +53,8 @@ jobs: node-version: 20 - name: Set up Dependencies + env: + LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }} run: | pip install requests boto3 pytest localstack-sdk-python pip install localstack-ci-extension-plugins/pytest_plugin From 5e2801e44878ebe855c2ca7c0ca44767c113c3bc Mon Sep 17 00:00:00 2001 From: Vlad Gramuzov Date: Wed, 27 Nov 2024 20:34:57 +0100 Subject: [PATCH 10/46] update test workflow --- .github/workflows/integration-test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 5c08a1b..c48fd46 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -54,6 +54,7 @@ jobs: - name: Set up Dependencies env: + API_ENDPOINT: 'https://api.staging.aws.localstack.cloud/v1' LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }} run: | pip install requests boto3 pytest localstack-sdk-python From 14ed91d77613bcfd1bf72c28d9cab32a43a74bee Mon Sep 17 00:00:00 2001 From: Vlad Gramuzov Date: Wed, 27 Nov 2024 20:38:26 +0100 Subject: [PATCH 11/46] update test workflow --- .github/workflows/integration-test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index c48fd46..bbf5791 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -53,15 +53,15 @@ jobs: node-version: 20 - name: Set up Dependencies - env: - API_ENDPOINT: 'https://api.staging.aws.localstack.cloud/v1' - LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }} run: | pip install requests boto3 pytest localstack-sdk-python pip install localstack-ci-extension-plugins/pytest_plugin pip install localstack - name: Prepare LocalStack + env: + API_ENDPOINT: 'https://api.staging.aws.localstack.cloud/v1' + LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }} run: | localstack extensions dev enable ./localstack-ci-extension From 2caf10359a1236f0ae8dfb24cb68f5be8f0ed4a9 Mon Sep 17 00:00:00 2001 From: Vlad Gramuzov Date: Wed, 27 Nov 2024 20:49:10 +0100 Subject: [PATCH 12/46] update test workflow --- .github/workflows/integration-test.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index bbf5791..c283fd4 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -75,7 +75,11 @@ jobs: LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }} LOCALSTACK_PROJECT_ID: ${{ secrets.LOCALSTACK_PROJECT_ID }} LOCALSTACK_PIPELINE_ID: ${{ secrets.LOCALSTACK_PIPELINE_ID }} - run: localstack start + run: | + localstack start -d + while ! localstack logs | grep -q "activated CI Extension"; do \ + sleep 1 \ + done - name: Deploy infrastructure run: | From 3ebb0f0517217649df3fd628db3d890c0c9c8015 Mon Sep 17 00:00:00 2001 From: Vlad Gramuzov Date: Wed, 27 Nov 2024 20:52:42 +0100 Subject: [PATCH 13/46] update test workflow --- .github/workflows/integration-test.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index c283fd4..742248a 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -77,9 +77,19 @@ jobs: LOCALSTACK_PIPELINE_ID: ${{ secrets.LOCALSTACK_PIPELINE_ID }} run: | localstack start -d - while ! localstack logs | grep -q "activated CI Extension"; do \ - sleep 1 \ + + - name: Wait for LocalStack to be ready + run: | + echo "Waiting for LocalStack CI extension to activate..." + for i in {1..60}; do + if localstack logs | grep -q "ci extension activated"; then + echo "CI extension activated. Proceeding..." + exit 0 + fi + sleep 5 done + echo "CI extension not activated in time. Failing..." + exit 1 - name: Deploy infrastructure run: | From b4327cdfb4d8afb34575aa5b42e58449d93de2e6 Mon Sep 17 00:00:00 2001 From: Vlad Gramuzov Date: Wed, 27 Nov 2024 21:08:14 +0100 Subject: [PATCH 14/46] update test workflow --- .github/workflows/integration-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 742248a..71f0870 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -82,7 +82,7 @@ jobs: run: | echo "Waiting for LocalStack CI extension to activate..." for i in {1..60}; do - if localstack logs | grep -q "ci extension activated"; then + if localstack logs | grep -q "activated CI Extension"; then echo "CI extension activated. Proceeding..." exit 0 fi From 4e4469fca8b777ae32e8b676d63dfcba1a781077 Mon Sep 17 00:00:00 2001 From: Vlad Gramuzov Date: Wed, 27 Nov 2024 21:13:56 +0100 Subject: [PATCH 15/46] update test workflow --- .github/workflows/integration-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 71f0870..91f50f9 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -76,7 +76,7 @@ jobs: LOCALSTACK_PROJECT_ID: ${{ secrets.LOCALSTACK_PROJECT_ID }} LOCALSTACK_PIPELINE_ID: ${{ secrets.LOCALSTACK_PIPELINE_ID }} run: | - localstack start -d + localstack start - name: Wait for LocalStack to be ready run: | From cf339461d99b87005188560f94a826e689fa816b Mon Sep 17 00:00:00 2001 From: Vlad Gramuzov Date: Wed, 27 Nov 2024 21:32:05 +0100 Subject: [PATCH 16/46] update test workflow --- .github/workflows/integration-test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 91f50f9..edc30de 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -63,6 +63,7 @@ jobs: API_ENDPOINT: 'https://api.staging.aws.localstack.cloud/v1' LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }} run: | + ls -al localstack-ci-extension localstack extensions dev enable ./localstack-ci-extension - name: Start LocalStack From ff41d3ad8d8306ecabd32148010c5f9f2cc6ffe6 Mon Sep 17 00:00:00 2001 From: Vlad Gramuzov Date: Wed, 27 Nov 2024 21:35:20 +0100 Subject: [PATCH 17/46] update test workflow --- .github/workflows/integration-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index edc30de..4bdae0f 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -70,9 +70,9 @@ jobs: env: LS_LOG: trace DEBUG: 1 - EXTENSION_DEV_MODE: 1 DOCKER_FLAGS: -e API_ENDPOINT=https://api.staging.aws.localstack.cloud/v1 API_ENDPOINT: 'https://api.staging.aws.localstack.cloud/v1' + LOCALSTACK_EXTENSION_DEV_MODE: 1 LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }} LOCALSTACK_PROJECT_ID: ${{ secrets.LOCALSTACK_PROJECT_ID }} LOCALSTACK_PIPELINE_ID: ${{ secrets.LOCALSTACK_PIPELINE_ID }} From 00e5a281782e2767f83732cf13b590b329c08ffa Mon Sep 17 00:00:00 2001 From: Vlad Gramuzov Date: Wed, 27 Nov 2024 22:26:29 +0100 Subject: [PATCH 18/46] update test workflow --- .github/workflows/integration-test.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 4bdae0f..ca43f42 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -68,11 +68,10 @@ jobs: - name: Start LocalStack env: - LS_LOG: trace DEBUG: 1 DOCKER_FLAGS: -e API_ENDPOINT=https://api.staging.aws.localstack.cloud/v1 API_ENDPOINT: 'https://api.staging.aws.localstack.cloud/v1' - LOCALSTACK_EXTENSION_DEV_MODE: 1 + EXTENSION_DEV_MODE: 1 LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }} LOCALSTACK_PROJECT_ID: ${{ secrets.LOCALSTACK_PROJECT_ID }} LOCALSTACK_PIPELINE_ID: ${{ secrets.LOCALSTACK_PIPELINE_ID }} From f45134c9e7b3e20074333dd0bf3cdc183e328b5c Mon Sep 17 00:00:00 2001 From: Vlad Gramuzov Date: Wed, 27 Nov 2024 22:37:23 +0100 Subject: [PATCH 19/46] update test workflow --- .github/workflows/integration-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index ca43f42..d045ec4 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -63,7 +63,7 @@ jobs: API_ENDPOINT: 'https://api.staging.aws.localstack.cloud/v1' LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }} run: | - ls -al localstack-ci-extension + docker pull localstack/localstack-pro:3.8.1 localstack extensions dev enable ./localstack-ci-extension - name: Start LocalStack From bb066cf655ae04933381549dd6411b0368ec1afc Mon Sep 17 00:00:00 2001 From: Vlad Gramuzov Date: Wed, 27 Nov 2024 22:40:26 +0100 Subject: [PATCH 20/46] update test workflow --- .github/workflows/integration-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index d045ec4..b001ec7 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -56,7 +56,7 @@ jobs: run: | pip install requests boto3 pytest localstack-sdk-python pip install localstack-ci-extension-plugins/pytest_plugin - pip install localstack + pip install localstack==3.8.1 - name: Prepare LocalStack env: From aa5d68cbee3c5e273160b42ea4b2924844845bec Mon Sep 17 00:00:00 2001 From: Vlad Gramuzov Date: Wed, 27 Nov 2024 23:01:29 +0100 Subject: [PATCH 21/46] update test workflow --- .github/workflows/integration-test.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index b001ec7..4d74844 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -56,20 +56,19 @@ jobs: run: | pip install requests boto3 pytest localstack-sdk-python pip install localstack-ci-extension-plugins/pytest_plugin - pip install localstack==3.8.1 + pip install localstack - name: Prepare LocalStack env: API_ENDPOINT: 'https://api.staging.aws.localstack.cloud/v1' LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }} run: | - docker pull localstack/localstack-pro:3.8.1 localstack extensions dev enable ./localstack-ci-extension - name: Start LocalStack env: DEBUG: 1 - DOCKER_FLAGS: -e API_ENDPOINT=https://api.staging.aws.localstack.cloud/v1 + DOCKER_FLAGS: --e API_ENDPOINT=https://api.staging.aws.localstack.cloud/v1 API_ENDPOINT: 'https://api.staging.aws.localstack.cloud/v1' EXTENSION_DEV_MODE: 1 LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }} From 1d0986e1667f271d51bf7e071c5cf79829840807 Mon Sep 17 00:00:00 2001 From: Vlad Gramuzov Date: Wed, 27 Nov 2024 23:07:14 +0100 Subject: [PATCH 22/46] update test workflow --- .github/workflows/integration-test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 4d74844..767e78a 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -68,7 +68,8 @@ jobs: - name: Start LocalStack env: DEBUG: 1 - DOCKER_FLAGS: --e API_ENDPOINT=https://api.staging.aws.localstack.cloud/v1 + # note LOCALSTACK_API_ENDPOINT is to support staging inside the extension for now + DOCKER_FLAGS: -e LOCALSTACK_API_ENDPOINT=https://api.staging.aws.localstack.cloud/v1 API_ENDPOINT: 'https://api.staging.aws.localstack.cloud/v1' EXTENSION_DEV_MODE: 1 LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }} From 6d1055d84ce9b2efe534eec79dc82635240be2b3 Mon Sep 17 00:00:00 2001 From: Vlad Gramuzov Date: Thu, 28 Nov 2024 00:08:53 +0100 Subject: [PATCH 23/46] update test workflow --- .github/workflows/integration-test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 767e78a..49ef2bd 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -69,14 +69,14 @@ jobs: env: DEBUG: 1 # note LOCALSTACK_API_ENDPOINT is to support staging inside the extension for now - DOCKER_FLAGS: -e LOCALSTACK_API_ENDPOINT=https://api.staging.aws.localstack.cloud/v1 + DOCKER_FLAGS: -e API_ENDPOINT=https://api.staging.aws.localstack.cloud/v1 API_ENDPOINT: 'https://api.staging.aws.localstack.cloud/v1' EXTENSION_DEV_MODE: 1 LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }} LOCALSTACK_PROJECT_ID: ${{ secrets.LOCALSTACK_PROJECT_ID }} LOCALSTACK_PIPELINE_ID: ${{ secrets.LOCALSTACK_PIPELINE_ID }} run: | - localstack start + DOCKER_FLAGS=$DOCKER_FLAGS localstack start - name: Wait for LocalStack to be ready run: | From d968e33cd615eeb74f084b00e781e9ebd1301ff6 Mon Sep 17 00:00:00 2001 From: Vlad Gramuzov Date: Thu, 28 Nov 2024 00:48:02 +0100 Subject: [PATCH 24/46] update test workflow --- .github/workflows/integration-test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 49ef2bd..16b8be4 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -61,7 +61,7 @@ jobs: - name: Prepare LocalStack env: API_ENDPOINT: 'https://api.staging.aws.localstack.cloud/v1' - LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }} + LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_API_KEY }} run: | localstack extensions dev enable ./localstack-ci-extension @@ -72,7 +72,7 @@ jobs: DOCKER_FLAGS: -e API_ENDPOINT=https://api.staging.aws.localstack.cloud/v1 API_ENDPOINT: 'https://api.staging.aws.localstack.cloud/v1' EXTENSION_DEV_MODE: 1 - LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }} + LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_API_KEY }} LOCALSTACK_PROJECT_ID: ${{ secrets.LOCALSTACK_PROJECT_ID }} LOCALSTACK_PIPELINE_ID: ${{ secrets.LOCALSTACK_PIPELINE_ID }} run: | From e0dbf411e669eadbb1845a22b9afdade72486532 Mon Sep 17 00:00:00 2001 From: Vlad Gramuzov Date: Thu, 28 Nov 2024 00:56:08 +0100 Subject: [PATCH 25/46] update test workflow --- .github/workflows/integration-test.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 16b8be4..8fdc237 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -68,7 +68,6 @@ jobs: - name: Start LocalStack env: DEBUG: 1 - # note LOCALSTACK_API_ENDPOINT is to support staging inside the extension for now DOCKER_FLAGS: -e API_ENDPOINT=https://api.staging.aws.localstack.cloud/v1 API_ENDPOINT: 'https://api.staging.aws.localstack.cloud/v1' EXTENSION_DEV_MODE: 1 @@ -76,12 +75,12 @@ jobs: LOCALSTACK_PROJECT_ID: ${{ secrets.LOCALSTACK_PROJECT_ID }} LOCALSTACK_PIPELINE_ID: ${{ secrets.LOCALSTACK_PIPELINE_ID }} run: | - DOCKER_FLAGS=$DOCKER_FLAGS localstack start + DOCKER_FLAGS=$DOCKER_FLAGS localstack start -d - name: Wait for LocalStack to be ready run: | echo "Waiting for LocalStack CI extension to activate..." - for i in {1..60}; do + for i in {1..10}; do if localstack logs | grep -q "activated CI Extension"; then echo "CI extension activated. Proceeding..." exit 0 From c8f742693312126842b6c752c95001c407702ab1 Mon Sep 17 00:00:00 2001 From: Vlad Gramuzov Date: Thu, 28 Nov 2024 01:01:17 +0100 Subject: [PATCH 26/46] update test workflow --- .github/workflows/integration-test.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 8fdc237..b01b4ad 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -58,12 +58,12 @@ jobs: pip install localstack-ci-extension-plugins/pytest_plugin pip install localstack - - name: Prepare LocalStack - env: - API_ENDPOINT: 'https://api.staging.aws.localstack.cloud/v1' - LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_API_KEY }} - run: | - localstack extensions dev enable ./localstack-ci-extension +# - name: Prepare LocalStack +# env: +# API_ENDPOINT: 'https://api.staging.aws.localstack.cloud/v1' +# LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_API_KEY }} +# run: | +# localstack extensions dev enable ./localstack-ci-extension - name: Start LocalStack env: @@ -75,7 +75,8 @@ jobs: LOCALSTACK_PROJECT_ID: ${{ secrets.LOCALSTACK_PROJECT_ID }} LOCALSTACK_PIPELINE_ID: ${{ secrets.LOCALSTACK_PIPELINE_ID }} run: | - DOCKER_FLAGS=$DOCKER_FLAGS localstack start -d + localstack extensions dev enable ./localstack-ci-extension && \ + DOCKER_FLAGS=$DOCKER_FLAGS localstack start -d - name: Wait for LocalStack to be ready run: | From deae3ee1ead89be61efb48b849497d7910ea6c30 Mon Sep 17 00:00:00 2001 From: Vlad Gramuzov Date: Thu, 28 Nov 2024 01:06:43 +0100 Subject: [PATCH 27/46] update test workflow --- .github/workflows/integration-test.yml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index b01b4ad..56c675a 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -17,7 +17,10 @@ on: type: choice options: - ubuntu-latest - +env: + LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }} + LOCALSTACK_PROJECT_ID: ${{ secrets.LOCALSTACK_PROJECT_ID }} + LOCALSTACK_PIPELINE_ID: ${{ secrets.LOCALSTACK_PIPELINE_ID }} jobs: integration-test-job: @@ -65,15 +68,19 @@ jobs: # run: | # localstack extensions dev enable ./localstack-ci-extension + # uncomment the following lines if you need to ssh into the GH Action: + - name: Setup upterm session + uses: lhotari/action-upterm@v1 + with: + limit-access-to-actor: true + limit-access-to-users: pandomic,whummer,joe4dev,dfangl,dominikschubert + - name: Start LocalStack env: DEBUG: 1 DOCKER_FLAGS: -e API_ENDPOINT=https://api.staging.aws.localstack.cloud/v1 API_ENDPOINT: 'https://api.staging.aws.localstack.cloud/v1' EXTENSION_DEV_MODE: 1 - LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_API_KEY }} - LOCALSTACK_PROJECT_ID: ${{ secrets.LOCALSTACK_PROJECT_ID }} - LOCALSTACK_PIPELINE_ID: ${{ secrets.LOCALSTACK_PIPELINE_ID }} run: | localstack extensions dev enable ./localstack-ci-extension && \ DOCKER_FLAGS=$DOCKER_FLAGS localstack start -d From 5c51eec96ed0464eb87c7917ee6ad15ad654df1e Mon Sep 17 00:00:00 2001 From: Vlad Gramuzov Date: Thu, 28 Nov 2024 01:14:58 +0100 Subject: [PATCH 28/46] update test workflow --- .github/workflows/integration-test.yml | 31 +++++++++++++++----------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 56c675a..bcc6aed 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -61,19 +61,18 @@ jobs: pip install localstack-ci-extension-plugins/pytest_plugin pip install localstack -# - name: Prepare LocalStack -# env: -# API_ENDPOINT: 'https://api.staging.aws.localstack.cloud/v1' -# LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_API_KEY }} -# run: | -# localstack extensions dev enable ./localstack-ci-extension + - name: Prepare LocalStack + run: | + LOCALSTACK_API_KEY=$LOCALSTACK_API_KEY \ + API_ENDPOINT=https://api.staging.aws.localstack.cloud/v1 \ + localstack extensions dev enable ./localstack-ci-extension # uncomment the following lines if you need to ssh into the GH Action: - - name: Setup upterm session - uses: lhotari/action-upterm@v1 - with: - limit-access-to-actor: true - limit-access-to-users: pandomic,whummer,joe4dev,dfangl,dominikschubert +# - name: Setup upterm session +# uses: lhotari/action-upterm@v1 +# with: +# limit-access-to-actor: true +# limit-access-to-users: pandomic,whummer,joe4dev,dfangl,dominikschubert - name: Start LocalStack env: @@ -82,8 +81,14 @@ jobs: API_ENDPOINT: 'https://api.staging.aws.localstack.cloud/v1' EXTENSION_DEV_MODE: 1 run: | - localstack extensions dev enable ./localstack-ci-extension && \ - DOCKER_FLAGS=$DOCKER_FLAGS localstack start -d + DEBUG=1 \ + LOCALSTACK_API_KEY=$LOCALSTACK_API_KEY \ + LOCALSTACK_PROJECT_ID=$LOCALSTACK_PROJECT_ID \ + LOCALSTACK_PIPELINE_ID=$LOCALSTACK_PIPELINE_ID \ + DOCKER_FLAGS=-e API_ENDPOINT=https://api.staging.aws.localstack.cloud/v1 \ + API_ENDPOINT=https://api.staging.aws.localstack.cloud/v1 \ + EXTENSION_DEV_MODE=1 \ + localstack start -d - name: Wait for LocalStack to be ready run: | From 3a097be779c4e714a6ee9f146daa8c43a5d50a61 Mon Sep 17 00:00:00 2001 From: Vlad Gramuzov Date: Thu, 28 Nov 2024 01:17:40 +0100 Subject: [PATCH 29/46] update test workflow --- .github/workflows/integration-test.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index bcc6aed..d819224 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -75,17 +75,12 @@ jobs: # limit-access-to-users: pandomic,whummer,joe4dev,dfangl,dominikschubert - name: Start LocalStack - env: - DEBUG: 1 - DOCKER_FLAGS: -e API_ENDPOINT=https://api.staging.aws.localstack.cloud/v1 - API_ENDPOINT: 'https://api.staging.aws.localstack.cloud/v1' - EXTENSION_DEV_MODE: 1 run: | DEBUG=1 \ LOCALSTACK_API_KEY=$LOCALSTACK_API_KEY \ LOCALSTACK_PROJECT_ID=$LOCALSTACK_PROJECT_ID \ LOCALSTACK_PIPELINE_ID=$LOCALSTACK_PIPELINE_ID \ - DOCKER_FLAGS=-e API_ENDPOINT=https://api.staging.aws.localstack.cloud/v1 \ + DOCKER_FLAGS="-e API_ENDPOINT=https://api.staging.aws.localstack.cloud/v1" \ API_ENDPOINT=https://api.staging.aws.localstack.cloud/v1 \ EXTENSION_DEV_MODE=1 \ localstack start -d From 452cad62ab4fbf24037e190568a2ac05505bd464 Mon Sep 17 00:00:00 2001 From: Vlad Gramuzov Date: Thu, 28 Nov 2024 03:04:17 +0100 Subject: [PATCH 30/46] update test workflow --- .github/workflows/integration-test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index d819224..462f060 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -82,6 +82,7 @@ jobs: LOCALSTACK_PIPELINE_ID=$LOCALSTACK_PIPELINE_ID \ DOCKER_FLAGS="-e API_ENDPOINT=https://api.staging.aws.localstack.cloud/v1" \ API_ENDPOINT=https://api.staging.aws.localstack.cloud/v1 \ + DNS_NAME_PATTERNS_TO_RESOLVE_UPSTREAM="*cianalyticsbucket*" \ EXTENSION_DEV_MODE=1 \ localstack start -d From 0328b51b36a9820bee2b3d3c44d797c638ae4a88 Mon Sep 17 00:00:00 2001 From: Vlad Gramuzov Date: Thu, 28 Nov 2024 03:21:57 +0100 Subject: [PATCH 31/46] update test workflow --- .github/workflows/integration-test.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 462f060..2af1f34 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -29,6 +29,7 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + path: app - name: Checkout CI Extension uses: actions/checkout@v4 @@ -62,10 +63,11 @@ jobs: pip install localstack - name: Prepare LocalStack + working-directory: ./localstack-ci-extension run: | LOCALSTACK_API_KEY=$LOCALSTACK_API_KEY \ API_ENDPOINT=https://api.staging.aws.localstack.cloud/v1 \ - localstack extensions dev enable ./localstack-ci-extension + localstack extensions dev enable . # uncomment the following lines if you need to ssh into the GH Action: # - name: Setup upterm session @@ -75,6 +77,7 @@ jobs: # limit-access-to-users: pandomic,whummer,joe4dev,dfangl,dominikschubert - name: Start LocalStack + working-directory: ./app run: | DEBUG=1 \ LOCALSTACK_API_KEY=$LOCALSTACK_API_KEY \ @@ -100,6 +103,7 @@ jobs: exit 1 - name: Deploy infrastructure + working-directory: ./app run: | START_TIME=$(date -u +"%Y-%m-%dT%H:%M:%S.%3NZ") bash bin/deploy.sh @@ -135,6 +139,7 @@ jobs: AWS_REGION: us-east-1 AWS_ACCESS_KEY_ID: test AWS_SECRET_ACCESS_KEY: test + working-directory: ./app run: | pytest tests @@ -144,11 +149,13 @@ jobs: localstack logs - name: Generate a Diagnostic Report + working-directory: ./app if: failure() run: | curl -s localhost:4566/_localstack/diagnose | gzip -cf > diagnose.json.gz - name: Upload the Diagnostic Report + working-directory: ./app if: failure() uses: actions/upload-artifact@v3 with: From d5fac064773a2d874fa015edd249e187dd8ca4b5 Mon Sep 17 00:00:00 2001 From: Vlad Gramuzov Date: Thu, 28 Nov 2024 03:23:04 +0100 Subject: [PATCH 32/46] update test workflow --- .github/workflows/integration-test.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 2af1f34..b02d4d5 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -149,13 +149,11 @@ jobs: localstack logs - name: Generate a Diagnostic Report - working-directory: ./app if: failure() run: | curl -s localhost:4566/_localstack/diagnose | gzip -cf > diagnose.json.gz - name: Upload the Diagnostic Report - working-directory: ./app if: failure() uses: actions/upload-artifact@v3 with: From b228d2f31ea15d0a570c0fcccbf5b48272411a07 Mon Sep 17 00:00:00 2001 From: Vlad Gramuzov Date: Thu, 28 Nov 2024 03:24:32 +0100 Subject: [PATCH 33/46] update test workflow --- .github/workflows/integration-test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index b02d4d5..31718df 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -29,7 +29,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - path: app + with: + path: app - name: Checkout CI Extension uses: actions/checkout@v4 From 921b2955d54835948b9919e2ba6cefdc6332a9f6 Mon Sep 17 00:00:00 2001 From: Vlad Gramuzov Date: Thu, 28 Nov 2024 10:31:50 +0100 Subject: [PATCH 34/46] update test workflow --- .github/workflows/integration-test.yml | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 31718df..269b7bb 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -29,8 +29,6 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - with: - path: app - name: Checkout CI Extension uses: actions/checkout@v4 @@ -62,23 +60,15 @@ jobs: pip install requests boto3 pytest localstack-sdk-python pip install localstack-ci-extension-plugins/pytest_plugin pip install localstack + cd localstack-ci-extension && pip install -e . && cd - - name: Prepare LocalStack - working-directory: ./localstack-ci-extension run: | LOCALSTACK_API_KEY=$LOCALSTACK_API_KEY \ API_ENDPOINT=https://api.staging.aws.localstack.cloud/v1 \ - localstack extensions dev enable . - - # uncomment the following lines if you need to ssh into the GH Action: -# - name: Setup upterm session -# uses: lhotari/action-upterm@v1 -# with: -# limit-access-to-actor: true -# limit-access-to-users: pandomic,whummer,joe4dev,dfangl,dominikschubert + localstack extensions dev enable ./localstack-ci-extension - name: Start LocalStack - working-directory: ./app run: | DEBUG=1 \ LOCALSTACK_API_KEY=$LOCALSTACK_API_KEY \ @@ -104,7 +94,6 @@ jobs: exit 1 - name: Deploy infrastructure - working-directory: ./app run: | START_TIME=$(date -u +"%Y-%m-%dT%H:%M:%S.%3NZ") bash bin/deploy.sh @@ -140,7 +129,6 @@ jobs: AWS_REGION: us-east-1 AWS_ACCESS_KEY_ID: test AWS_SECRET_ACCESS_KEY: test - working-directory: ./app run: | pytest tests From 222f2b997807c6f45224b82949cb2a30169c9f1c Mon Sep 17 00:00:00 2001 From: Vlad Gramuzov Date: Thu, 28 Nov 2024 10:34:53 +0100 Subject: [PATCH 35/46] update test workflow --- .github/workflows/integration-test.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 269b7bb..8d05a85 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -57,9 +57,8 @@ jobs: - name: Set up Dependencies run: | - pip install requests boto3 pytest localstack-sdk-python + pip install localstack requests boto3 pytest localstack-sdk-python awscli-local pip install localstack-ci-extension-plugins/pytest_plugin - pip install localstack cd localstack-ci-extension && pip install -e . && cd - - name: Prepare LocalStack From 4f66506f0ade8745311a9fece5341855f658e688 Mon Sep 17 00:00:00 2001 From: Vlad Gramuzov Date: Thu, 28 Nov 2024 11:19:54 +0100 Subject: [PATCH 36/46] update test workflow --- .github/workflows/integration-test.yml | 42 +++++++++++++++----------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 8d05a85..4079881 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -99,28 +99,36 @@ jobs: END_TIME=$(date -u +"%Y-%m-%dT%H:%M:%S.%3NZ") curl -X POST http://localhost:4566/_localstack/extensions/ci/steps \ -H "Content-Type: application/json" \ - -d '[{ - "step_id": "deploy", - "name": "Deploy Infrastructure", - "step_type" : "deploy", - "state": "passed", - "time_start": "'"$START_TIME"'", - "time_end": "'"$END_TIME"'" - }]' - + -d '{ + "steps": [ + { + "step_id": "deploy", + "name": "Deploy Infrastructure", + "step_type" : "deploy", + "state": "passed", + "time_start": "'"$START_TIME"'", + "time_end": "'"$END_TIME"'" + } + ] + }' + START_TIME=$(date -u +"%Y-%m-%dT%H:%M:%S.%3NZ") bash bin/seed.sh END_TIME=$(date -u +"%Y-%m-%dT%H:%M:%S.%3NZ") curl -X POST http://localhost:4566/_localstack/extensions/ci/steps \ -H "Content-Type: application/json" \ - -d '[{ - "step_id": "seed", - "name": "Seed Data", - "step_type" : "deploy", - "state": "passed", - "time_start": "'"$START_TIME"'", - "time_end": "'"$END_TIME"'" - }]' + -d '{ + "steps": [ + { + "step_id": "seed", + "name": "Seed Data", + "step_type" : "deploy", + "state": "passed", + "time_start": "'"$START_TIME"'", + "time_end": "'"$END_TIME"'" + } + ] + }' - name: Run Tests env: From 89f620e32a13fccad7aafcb9cd616b16b5cc3ffd Mon Sep 17 00:00:00 2001 From: Vlad Gramuzov Date: Thu, 28 Nov 2024 12:12:49 +0100 Subject: [PATCH 37/46] update test workflow --- lambdas/utils/__init__.py | 10 ++++++++++ tests/conftest.py | 3 +++ tests/test_infra.py | 33 +++++++++++++++++++++++++++------ tests/test_outage.py | 13 ++++++++----- 4 files changed, 48 insertions(+), 11 deletions(-) create mode 100644 lambdas/utils/__init__.py create mode 100644 tests/conftest.py diff --git a/lambdas/utils/__init__.py b/lambdas/utils/__init__.py new file mode 100644 index 0000000..8f35413 --- /dev/null +++ b/lambdas/utils/__init__.py @@ -0,0 +1,10 @@ +import json + +def prepare_response(status_code, body): + return { + "statusCode": status_code, + "body": json.dumps(body), + "headers": { + "Content-Type": "application/json", + } + } diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 0000000..b9f9ca8 --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,3 @@ +import logging + +logging.basicConfig(level=logging.DEBUG) diff --git a/tests/test_infra.py b/tests/test_infra.py index 4a46478..086fefb 100644 --- a/tests/test_infra.py +++ b/tests/test_infra.py @@ -4,6 +4,11 @@ import localstack.sdk.aws import json import time +import logging + +from lambdas.utils import prepare_response + +LOG = logging.getLogger(__name__) @pytest.fixture(scope='module') def api_endpoint(): @@ -21,7 +26,7 @@ def api_endpoint(): API_ID = api['id'] API_ENDPOINT = f"http://localhost:4566/restapis/{API_ID}/test/_user_request_" - print(f"API Endpoint: {API_ENDPOINT}") + LOG.info(f"API Endpoint: {API_ENDPOINT}") time.sleep(2) @@ -78,7 +83,7 @@ def test_quiz_workflow(api_endpoint): assert 'QuizID' in quiz_creation_response quiz_id = quiz_creation_response['QuizID'] - print(f"Quiz created with ID: {quiz_id}") + LOG.info(f"Quiz created with ID: {quiz_id}") response = requests.get(f"{api_endpoint}/listquizzes") assert response.status_code == 200 @@ -149,7 +154,7 @@ def test_quiz_workflow(api_endpoint): "SubmissionID": submission_response["SubmissionID"] }) - print(f"{user['Username']} submitted quiz with SubmissionID: {submission_response['SubmissionID']}") + LOG.info(f"{user['Username']} submitted quiz with SubmissionID: {submission_response['SubmissionID']}") time.sleep(5) @@ -191,7 +196,7 @@ def calculate_user_score(user_answers): expected_score = expected_scores[username] assert actual_score == pytest.approx(expected_score, abs=0.01) - print(f"{username} - Expected Score: {expected_score}, Actual Score: {actual_score}") + LOG.info(f"{username} - Expected Score: {expected_score}, Actual Score: {actual_score}") for submission in submissions: response = requests.get(f"{api_endpoint}/getsubmission?submission_id={submission['SubmissionID']}") @@ -206,7 +211,7 @@ def calculate_user_score(user_answers): actual_score = submission_data['Score'] assert actual_score == pytest.approx(expected_score, abs=0.01) - print(f"Verified submission for {submission['Username']} with Score: {actual_score}") + LOG.info(f"Verified submission for {submission['Username']} with Score: {actual_score}") client = localstack.sdk.aws.AWSClient() sender_email = "sender@example.com" @@ -227,6 +232,22 @@ def calculate_user_score(user_answers): assert hasattr(body, 'html_part') html_content = body.html_part - print(f"Email content: {html_content}") + LOG.info(f"Email content: {html_content}") assert email_found, f"No email found sent from {sender_email}" + +def test_faulty_assertion(api_endpoint): + test_quiz_workflow(api_endpoint=api_endpoint) + + response = requests.get(f"{api_endpoint}/getleaderboard?quiz_id=wrongid&top=3") + assert response.status_code == 200 + +def test_faulty_invocation(api_endpoint): + test_quiz_workflow(api_endpoint=api_endpoint) + + class NonSerializable: + pass + + response = prepare_response(200, NonSerializable()) + + assert response['statusCode'] == 200 diff --git a/tests/test_outage.py b/tests/test_outage.py index eb7331b..c636ffa 100644 --- a/tests/test_outage.py +++ b/tests/test_outage.py @@ -3,11 +3,14 @@ import boto3 import json import requests +import logging import localstack.sdk.chaos from localstack.sdk.models import FaultRule from localstack.sdk.chaos.managers import fault_configuration +LOG = logging.getLogger(__name__) + LOCALSTACK_ENDPOINT = "http://localhost.localstack.cloud:4566" API_NAME = 'QuizAPI' @@ -30,7 +33,7 @@ def api_endpoint(apigateway_client): API_ID = api['id'] API_ENDPOINT = f"{LOCALSTACK_ENDPOINT}/restapis/{API_ID}/test/_user_request_" - print(f"API Endpoint: {API_ENDPOINT}") + LOG.info(f"API Endpoint: {API_ENDPOINT}") time.sleep(2) @@ -41,7 +44,7 @@ def test_dynamodb_outage(api_endpoint): # Using fault_configuration context manager to apply and automatically clean up the fault rule with fault_configuration(fault_rules=[outage_rule]): - print("DynamoDB outage initiated within context.") + LOG.info("DynamoDB outage initiated within context.") # Attempt to create a quiz during the outage create_quiz_payload = { @@ -68,10 +71,10 @@ def test_dynamodb_outage(api_endpoint): assert response.status_code == 500 response_data = response.json() assert "Error storing quiz data. It has been queued for retry." in response_data.get("message", "") - print("Received expected error message during outage.") + LOG.info("Received expected error message during outage.") # After the context manager exits, the outage should be resolved - print("Waiting for the system to process the queued request...") + LOG.info("Waiting for the system to process the queued request...") time.sleep(15) # Check if the quiz was eventually created successfully @@ -80,4 +83,4 @@ def test_dynamodb_outage(api_endpoint): quizzes_list = response.json().get('Quizzes', []) quiz_titles = [quiz['Title'] for quiz in quizzes_list] assert "Outage Test Quiz" in quiz_titles - print("Quiz successfully created after outage resolved.") + LOG.info("Quiz successfully created after outage resolved.") From 7e10cd9d591a8f5952fad31f2ed0a8e5b35fbfb4 Mon Sep 17 00:00:00 2001 From: Vlad Gramuzov Date: Thu, 28 Nov 2024 12:25:45 +0100 Subject: [PATCH 38/46] update test workflow --- .github/workflows/integration-test.yml | 4 ++-- tests/conftest.py | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 4079881..39ff947 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -104,7 +104,7 @@ jobs: { "step_id": "deploy", "name": "Deploy Infrastructure", - "step_type" : "deploy", + "step_type" : "step", "state": "passed", "time_start": "'"$START_TIME"'", "time_end": "'"$END_TIME"'" @@ -122,7 +122,7 @@ jobs: { "step_id": "seed", "name": "Seed Data", - "step_type" : "deploy", + "step_type" : "step", "state": "passed", "time_start": "'"$START_TIME"'", "time_end": "'"$END_TIME"'" diff --git a/tests/conftest.py b/tests/conftest.py index b9f9ca8..36aa329 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,3 +1,7 @@ import logging +import sys -logging.basicConfig(level=logging.DEBUG) +logging.basicConfig( + level=logging.DEBUG, + stream=sys.stdout, +) From ccbcf26f1fa6a19a5b75635020e694661aa76df9 Mon Sep 17 00:00:00 2001 From: Vlad Gramuzov Date: Thu, 28 Nov 2024 12:44:04 +0100 Subject: [PATCH 39/46] update test workflow --- tests/conftest.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/conftest.py b/tests/conftest.py index 36aa329..56973f5 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,6 +1,8 @@ import logging import sys +logging.getLogger("urllib3").setLevel(logging.WARNING) + logging.basicConfig( level=logging.DEBUG, stream=sys.stdout, From 564ce5d7d72b61db46839fdc32519ab27c6ac096 Mon Sep 17 00:00:00 2001 From: Vlad Gramuzov Date: Thu, 28 Nov 2024 13:15:07 +0100 Subject: [PATCH 40/46] update test workflow --- .github/workflows/ephemeral.yml | 89 -------------------------- .github/workflows/integration-test.yml | 2 +- .github/workflows/preview.yml | 35 ---------- .gitignore | 1 + Makefile | 2 + setup.cfg | 24 +++++++ setup.py | 4 ++ 7 files changed, 32 insertions(+), 125 deletions(-) delete mode 100644 .github/workflows/ephemeral.yml delete mode 100644 .github/workflows/preview.yml create mode 100644 setup.cfg create mode 100644 setup.py diff --git a/.github/workflows/ephemeral.yml b/.github/workflows/ephemeral.yml deleted file mode 100644 index 3333ac8..0000000 --- a/.github/workflows/ephemeral.yml +++ /dev/null @@ -1,89 +0,0 @@ -name: Deploy Redirect to GitHub Pages - -on: - schedule: - - cron: '0 * * * *' - workflow_dispatch: - -permissions: - contents: write - -jobs: - deploy: - runs-on: ubuntu-latest - - steps: - - name: Checkout Repository - uses: actions/checkout@v4 - - - name: Set Up Git Configuration - run: | - git config user.name "GitHub Actions" - git config user.email "actions@github.com" - - - name: Set up Python 3.11 - id: setup-python - uses: actions/setup-python@v2 - with: - python-version: 3.11 - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: 20 - - - name: Install AWS CLI - run: | - pip install awscli awscli-local - - - name: Run Ephemeral Script and Capture Output - run: | - OUTPUT=$(bash bin/ephemeral.sh 2>&1) - echo "$OUTPUT" - NEW_URL=$(echo "$OUTPUT" | grep -Eo 'https://ls-[^ ]+') - - if [ -z "$NEW_URL" ]; then - echo "Error: Failed to extract URL from script output." - exit 1 - fi - - echo "Extracted URL: $NEW_URL" - - echo "NEW_URL=$NEW_URL" >> $GITHUB_ENV - env: - LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }} - - - name: Generate index.html with New Redirect URL - run: | - NEW_URL="${{ env.NEW_URL }}" - - # Validate the URL - if [[ ! "$NEW_URL" =~ ^https?:// ]]; then - echo "Error: Invalid URL provided." - exit 1 - fi - - echo "Redirecting to: $NEW_URL" - - cat > index.html < - - - - - Redirecting... - - -

If you are not redirected automatically, follow this link.

- - - EOL - - - name: Switch to gh-pages Branch and Commit Changes - run: | - git fetch origin gh-pages || echo "gh-pages branch does not exist; creating it." - git checkout gh-pages || git checkout --orphan gh-pages - git rm -rf . # Remove all files in the branch - git add index.html - git commit -m "Update redirect to ${NEW_URL}" - git push origin gh-pages --force diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 39ff947..3f62947 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -57,7 +57,7 @@ jobs: - name: Set up Dependencies run: | - pip install localstack requests boto3 pytest localstack-sdk-python awscli-local + make install pip install localstack-ci-extension-plugins/pytest_plugin cd localstack-ci-extension && pip install -e . && cd - diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml deleted file mode 100644 index e3a888d..0000000 --- a/.github/workflows/preview.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: 'Create Preview on Pull Request' -on: - workflow_dispatch: - pull_request: - types: [opened, synchronize, reopened] - -jobs: - localstack: - permissions: write-all - name: Setup LocalStack Preview - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: 20 - - name: LocalStack Preview - uses: LocalStack/setup-localstack@v0.2.3 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - state-backend: ephemeral - state-action: start - include-preview: 'true' - install-awslocal: 'true' - extension-auto-install: 'localstack-extension-mailhog' - preview-cmd: | - pip install awscli awscli-local - bash bin/deploy.sh - bash bin/seed.sh - distributionId=$(awslocal cloudfront list-distributions | jq -r '.DistributionList.Items[0].Id'); - echo LS_PREVIEW_URL=$AWS_ENDPOINT_URL/cloudfront/$distributionId/ >> $GITHUB_ENV; - env: - LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }} diff --git a/.gitignore b/.gitignore index e1a54cc..dfcbd3b 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ develop-eggs/ dist/ .env .venv +*.egg-info/ env/ venv/ __pycache__ diff --git a/Makefile b/Makefile index 5df3609..ce932af 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +install: + pip install -e .; usage: ## Show usage for this Makefile @cat Makefile | grep -E '^[a-zA-Z_-]+:.*?## .*$$' | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-15s\033[0m %s\n", $$1, $$2}' diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..4c7a0c7 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,24 @@ +[metadata] +name = serverless-quiz-app +version = 0.0.1 +url = localstack.cloud +author = LocalStack Team +author_email = info@localstack.cloud +description = LocalStack Quiz App +license = Proprietary +classifiers = + Programming Language :: Python :: 3.10 + Programming Language :: Python :: 3.11 + License :: Other/Proprietary License + Topic :: Software Development :: Testing + +[options] +zip_safe = False +packages = find_namespace: +install_requires = + localstack + requests + boto3 + pytest + localstack-sdk-python + awscli-local diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..c823345 --- /dev/null +++ b/setup.py @@ -0,0 +1,4 @@ +#!/usr/bin/env python +from setuptools import setup + +setup() From 75c54cbb655e83d8a3fae298541021e5f9dce421 Mon Sep 17 00:00:00 2001 From: Vlad Gramuzov Date: Thu, 28 Nov 2024 13:29:28 +0100 Subject: [PATCH 41/46] update test workflow --- .github/workflows/integration-test.yml | 4 ++-- tests/test_infra.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 3f62947..e8be511 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -19,8 +19,8 @@ on: - ubuntu-latest env: LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }} - LOCALSTACK_PROJECT_ID: ${{ secrets.LOCALSTACK_PROJECT_ID }} - LOCALSTACK_PIPELINE_ID: ${{ secrets.LOCALSTACK_PIPELINE_ID }} + LOCALSTACK_PROJECT_ID: ${{ env.LOCALSTACK_PROJECT_ID }} + LOCALSTACK_PIPELINE_ID: ${{ env.LOCALSTACK_PIPELINE_ID }} jobs: integration-test-job: diff --git a/tests/test_infra.py b/tests/test_infra.py index 086fefb..f06ac08 100644 --- a/tests/test_infra.py +++ b/tests/test_infra.py @@ -240,7 +240,7 @@ def test_faulty_assertion(api_endpoint): test_quiz_workflow(api_endpoint=api_endpoint) response = requests.get(f"{api_endpoint}/getleaderboard?quiz_id=wrongid&top=3") - assert response.status_code == 200 + assert response.status_code == 500 def test_faulty_invocation(api_endpoint): test_quiz_workflow(api_endpoint=api_endpoint) From d9d01c4ce1f8b5dcd8ac885292573544c12bea6d Mon Sep 17 00:00:00 2001 From: Vlad Gramuzov Date: Thu, 28 Nov 2024 13:40:46 +0100 Subject: [PATCH 42/46] update test workflow --- .github/workflows/integration-test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index e8be511..8cd4708 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -19,8 +19,8 @@ on: - ubuntu-latest env: LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }} - LOCALSTACK_PROJECT_ID: ${{ env.LOCALSTACK_PROJECT_ID }} - LOCALSTACK_PIPELINE_ID: ${{ env.LOCALSTACK_PIPELINE_ID }} +# LOCALSTACK_PROJECT_ID: ${{ env.LOCALSTACK_PROJECT_ID }} +# LOCALSTACK_PIPELINE_ID: ${{ env.LOCALSTACK_PIPELINE_ID }} jobs: integration-test-job: From 24d2dd76df5e2014f7a665b7575fe897aad2f8d4 Mon Sep 17 00:00:00 2001 From: Vlad Gramuzov Date: Thu, 28 Nov 2024 13:44:23 +0100 Subject: [PATCH 43/46] update test workflow --- .github/workflows/integration-test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 8cd4708..db4bea3 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -19,8 +19,8 @@ on: - ubuntu-latest env: LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }} -# LOCALSTACK_PROJECT_ID: ${{ env.LOCALSTACK_PROJECT_ID }} -# LOCALSTACK_PIPELINE_ID: ${{ env.LOCALSTACK_PIPELINE_ID }} + LOCALSTACK_PROJECT_ID: project_2dc06b1a-1222-4b0f-aad2-f2c967aa2296 + LOCALSTACK_PIPELINE_ID: pipeline_08678615-5c69-4da9-9a7a-b8a87e19e949 jobs: integration-test-job: From 0b34f4795c97b003ca537bfb267f25b8d7b299d0 Mon Sep 17 00:00:00 2001 From: Vlad Gramuzov Date: Thu, 28 Nov 2024 13:57:28 +0100 Subject: [PATCH 44/46] update test workflow --- tests/test_infra.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_infra.py b/tests/test_infra.py index f06ac08..88a2a6c 100644 --- a/tests/test_infra.py +++ b/tests/test_infra.py @@ -242,6 +242,7 @@ def test_faulty_assertion(api_endpoint): response = requests.get(f"{api_endpoint}/getleaderboard?quiz_id=wrongid&top=3") assert response.status_code == 500 +@pytest.mark.take_snapshot(before=True, after=True) def test_faulty_invocation(api_endpoint): test_quiz_workflow(api_endpoint=api_endpoint) From 9408e66336e0681c153ef3c0fa4b742f1da846f8 Mon Sep 17 00:00:00 2001 From: Vlad Gramuzov Date: Thu, 28 Nov 2024 14:08:02 +0100 Subject: [PATCH 45/46] update test workflow --- tests/test_infra.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_infra.py b/tests/test_infra.py index 88a2a6c..3408efb 100644 --- a/tests/test_infra.py +++ b/tests/test_infra.py @@ -242,7 +242,7 @@ def test_faulty_assertion(api_endpoint): response = requests.get(f"{api_endpoint}/getleaderboard?quiz_id=wrongid&top=3") assert response.status_code == 500 -@pytest.mark.take_snapshot(before=True, after=True) +@pytest.mark.resource_snapshot(before=True, after=True) def test_faulty_invocation(api_endpoint): test_quiz_workflow(api_endpoint=api_endpoint) From c5886ab48a774e0cb469d0fe177802eaf2b93e85 Mon Sep 17 00:00:00 2001 From: Vlad Gramuzov Date: Fri, 29 Nov 2024 14:08:07 +0100 Subject: [PATCH 46/46] update test workflow --- .github/workflows/integration-test.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index db4bea3..7d18e19 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -19,8 +19,8 @@ on: - ubuntu-latest env: LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }} - LOCALSTACK_PROJECT_ID: project_2dc06b1a-1222-4b0f-aad2-f2c967aa2296 - LOCALSTACK_PIPELINE_ID: pipeline_08678615-5c69-4da9-9a7a-b8a87e19e949 + LOCALSTACK_PROJECT_ID: project_1bipvrdld3 + LOCALSTACK_PIPELINE_ID: pipeline_dw7flhan3i jobs: integration-test-job: @@ -64,7 +64,6 @@ jobs: - name: Prepare LocalStack run: | LOCALSTACK_API_KEY=$LOCALSTACK_API_KEY \ - API_ENDPOINT=https://api.staging.aws.localstack.cloud/v1 \ localstack extensions dev enable ./localstack-ci-extension - name: Start LocalStack @@ -73,8 +72,6 @@ jobs: LOCALSTACK_API_KEY=$LOCALSTACK_API_KEY \ LOCALSTACK_PROJECT_ID=$LOCALSTACK_PROJECT_ID \ LOCALSTACK_PIPELINE_ID=$LOCALSTACK_PIPELINE_ID \ - DOCKER_FLAGS="-e API_ENDPOINT=https://api.staging.aws.localstack.cloud/v1" \ - API_ENDPOINT=https://api.staging.aws.localstack.cloud/v1 \ DNS_NAME_PATTERNS_TO_RESOLVE_UPSTREAM="*cianalyticsbucket*" \ EXTENSION_DEV_MODE=1 \ localstack start -d