Skip to content

Commit

Permalink
Add integration tests for ApiGateway (#195)
Browse files Browse the repository at this point in the history
This adds the first integration tests for ApiGateway. This will get us
to full coverage on ApiGateway constructs

Added on top of #194 so review
that one first.

re #183
  • Loading branch information
corymhall authored Nov 2, 2024
1 parent 33cb289 commit 1236da2
Show file tree
Hide file tree
Showing 28 changed files with 1,757 additions and 3,000 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/acceptance-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
on:
workflow_call:
inputs:
folder:
type: string
required: true
description: The folder in which to run tests

env:
AWS_REGION: us-west-2

jobs:
acceptance-tests:
runs-on: ubuntu-latest
concurrency:
group: ${{ inputs.folder }}-test-${{ matrix.index }} # TODO: concurrent tests across PRs can cause problems
cancel-in-progress: false
steps:
- name: Checkout Repo
uses: actions/checkout@v4
# Needed for pulumictl to calculate version
- name: Unshallow clone for tags
run: git fetch --prune --unshallow --tags
- name: Install pulumictl
uses: jaxxstorm/[email protected]
with:
repo: pulumi/pulumictl
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-region: ${{ env.AWS_REGION }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
role-duration-seconds: 3600
role-session-name: pulumi-cdk@githubActions
role-to-assume: ${{ secrets.AWS_CI_ROLE_ARN }}
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18.x
registry-url: https://registry.npmjs.org
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: 1.22.x
cache-dependency-path: ./*.sum
- name: Install Yarn
run: curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.13.0
- name: Install packages
run: yarn install --frozen-lockfile
- name: Run build
run: yarn run set-version && yarn run build
- name: yarn link
run: yarn link
- name: set script-shell
run: yarn config set script-shell /bin/bash
- name: Install gotestsum
run: go install gotest.tools/gotestsum@latest
- name: Generate go test Slice
id: test_split
uses: hashicorp-forge/[email protected]
with:
working-directory: ${{ inputs.folder }}
total: ${{ matrix.parallel }}
index: ${{ matrix.index }}
- name: Run ${{ inputs.folder }} tests
run: cd ${{ inputs.folder }} && gotestsum --format github-actions -- -v -count=1 -timeout 2h -parallel 4 -run "${{ steps.test_split.outputs.run }}"
strategy:
fail-fast: false
matrix:
parallel: [3]
index: [0, 1, 2]
75 changes: 14 additions & 61 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,67 +30,20 @@ jobs:
# On 'push' we've just merged a PR that ran the tests
if: github.event_name == 'schedule'
name: acceptance-test
concurrency:
group: acceptance-test-${{ matrix.index }} # TODO: concurrent tests across PRs can cause problems
cancel-in-progress: false
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
# Needed for pulumictl to calculate version
- name: Unshallow clone for tags
run: git fetch --prune --unshallow --tags
- name: Install pulumictl
uses: jaxxstorm/[email protected]
with:
repo: pulumi/pulumictl
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-region: ${{ env.AWS_REGION }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
role-duration-seconds: 3600
role-session-name: ${{ env.PROVIDER }}@githubActions
role-to-assume: ${{ secrets.AWS_CI_ROLE_ARN }}
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18.x
registry-url: https://registry.npmjs.org
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: 1.22.x
cache-dependency-path: examples/*.sum
- name: Install Yarn
run: curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.13.0
- name: Install packages
run: yarn install --frozen-lockfile
- name: Run build
run: yarn run set-version && yarn run build
- name: yarn link
run: yarn link
- name: set script-shell
run: yarn config set script-shell /bin/bash
- name: Install gotestsum
run: go install gotest.tools/gotestsum@latest
- name: Go mod download
run: cd examples && go mod download
- name: Generate go test Slice
id: test_split
uses: hashicorp-forge/[email protected]
with:
working-directory: examples
total: ${{ matrix.parallel }}
index: ${{ matrix.index }}
- name: Run examples
run: cd examples && gotestsum --format github-actions -- -v -count=1 -timeout 2h -parallel 4 -run "${{ steps.test_split.outputs.run }}"
strategy:
fail-fast: false
matrix:
parallel: [3]
index: [0, 1, 2]
uses: ./.github/workflows/acceptance-tests.yml
secrets: inherit
with:
folder: examples

integration-test:
# Only run tests on the schedule event
# On 'push' we've just merged a PR that ran the tests
if: github.event_name == 'schedule'
name: integration-test
uses: ./.github/workflows/acceptance-tests.yml
secrets: inherit
with:
folder: integration

release:
if: github.event_name == 'push'
Expand Down
72 changes: 11 additions & 61 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,67 +27,17 @@ jobs:

test:
name: acceptance-test
concurrency:
group: acceptance-test-${{ matrix.index }} # TODO: concurrent tests across PRs can cause problems
cancel-in-progress: false
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
# Needed for pulumictl to calculate version
- name: Unshallow clone for tags
run: git fetch --prune --unshallow --tags
- name: Install pulumictl
uses: jaxxstorm/[email protected]
with:
repo: pulumi/pulumictl
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-region: ${{ env.AWS_REGION }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
role-duration-seconds: 3600
role-session-name: ${{ env.PROVIDER }}@githubActions
role-to-assume: ${{ secrets.AWS_CI_ROLE_ARN }}
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18.x
registry-url: https://registry.npmjs.org
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: 1.22.x
cache-dependency-path: examples/*.sum
- name: Install Yarn
run: curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.13.0
- name: Install packages
run: yarn install --frozen-lockfile
- name: Run build
run: yarn run set-version && yarn run build
- name: yarn link
run: yarn link
- name: set script-shell
run: yarn config set script-shell /bin/bash
- name: Install gotestsum
run: go install gotest.tools/gotestsum@latest
- name: Go mod download
run: cd examples && go mod download
- name: Generate go test Slice
id: test_split
uses: hashicorp-forge/[email protected]
with:
working-directory: examples
total: ${{ matrix.parallel }}
index: ${{ matrix.index }}
- name: Run examples
run: cd examples && gotestsum --format github-actions -- -v -count=1 -timeout 2h -parallel 4 -run "${{ steps.test_split.outputs.run }}"
strategy:
fail-fast: false
matrix:
parallel: [3]
index: [0, 1, 2]
uses: ./.github/workflows/acceptance-tests.yml
secrets: inherit
with:
folder: examples

integration-test:
name: integration-test
uses: ./.github/workflows/acceptance-tests.yml
secrets: inherit
with:
folder: integration

release:
name: Release
Expand Down
74 changes: 11 additions & 63 deletions .github/workflows/run-acceptance-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,69 +43,17 @@ jobs:

test:
name: acceptance-test
concurrency:
group: acceptance-test-${{ matrix.index }} # TODO: concurrent tests across PRs can cause problems
# TODO[pulumi/pulumi-cdk#152]: means that some resources in tests will have a static name
# which if the test does not complete, will not be cleaned up causing the next run to fail with resource already exists
cancel-in-progress: false
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
# Needed for pulumictl to calculate version
- name: Unshallow clone for tags
run: git fetch --prune --unshallow --tags
- name: Install pulumictl
uses: jaxxstorm/[email protected]
with:
repo: pulumi/pulumictl
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-region: ${{ env.AWS_REGION }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
role-duration-seconds: 3600
role-session-name: ${{ env.PROVIDER }}@githubActions
role-to-assume: ${{ secrets.AWS_CI_ROLE_ARN }}
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18.x
registry-url: https://registry.npmjs.org
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: 1.22.x
cache-dependency-path: examples/*.sum
- name: Install Yarn
run: curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.13.0
- name: Install packages
run: yarn install --frozen-lockfile
- name: Run build
run: yarn run set-version && yarn run build
- name: yarn link
run: yarn link
- name: set script-shell
run: yarn config set script-shell /bin/bash
- name: Install gotestsum
run: go install gotest.tools/gotestsum@latest
- name: Go mod download
run: cd examples && go mod download
- name: Generate go test Slice
id: test_split
uses: hashicorp-forge/[email protected]
with:
working-directory: examples
total: ${{ matrix.parallel }}
index: ${{ matrix.index }}
- name: Run examples
run: cd examples && gotestsum --format github-actions -- -v -count=1 -timeout 2h -parallel 4 -run "${{ steps.test_split.outputs.run }}"
strategy:
fail-fast: false
matrix:
parallel: [3]
index: [0, 1, 2]
uses: ./.github/workflows/acceptance-tests.yml
secrets: inherit
with:
folder: examples

integration-test:
name: integration-test
secrets: inherit
uses: ./.github/workflows/acceptance-tests.yml
with:
folder: integration

name: Run Acceptance Tests from PR
on:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Pulumi.*.yaml

# Example lock files
examples/**/yarn.lock
integration/**/yarn.lock

# Logs
logs
Expand Down
Loading

0 comments on commit 1236da2

Please sign in to comment.