Skip to content

Acceptance Tests

Acceptance Tests #832

Workflow file for this run

name: Acceptance Tests
# In the future, we will need to figure out how we want to run acceptance tests
# since creation of deployments and clusters are costly
on:
pull_request:
push:
branches:
- main
paths-ignore:
- 'README.md'
schedule:
- cron: '30 21 * * 1' # Runs every Monday at 2:30PST for stage environment
- cron: '30 21 * * 2,5' # Runs every Tuesday and Friday at 2:30PST for dev environment
# Testing only needs permissions to read the repository contents.
permissions:
contents: read
jobs:
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version-file: 'go.mod'
cache: true
- run: go mod download
- run: go build -v .
testacc:
# This job runs on push to main branch.
name: Terraform Provider Acceptance Tests
needs: build
timeout-minutes: 180 # 3 hours since cluster creation and cluster updates can take a while
strategy:
fail-fast: true
matrix:
# list whatever Terraform versions here you would like to support
terraform:
- latest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version-file: 'go.mod'
cache: true
- uses: hashicorp/setup-terraform@651471c36a6092792c552e8b1bef71e592b462d8 # v3.1.1
with:
terraform_version: ${{ matrix.terraform }}
terraform_wrapper: false
- run: go mod download
- name: Determine if expensive tests should run
run: |
git fetch --all
echo "CHECKING FILES FOR SKIP LOGIC..."
SKIP_TESTS="True"
FILES_TO_CHECK=(
"internal/provider/schemas/deployment.go"
"internal/provider/schemas/cluster.go"
"internal/provider/models/deployment.go"
"internal/provider/models/cluster.go"
"internal/provider/resources/resource_cluster.go"
"internal/provider/resources/resource_cluster_test.go"
"internal/provider/resources/resource_deployment.go"
"internal/provider/resources/common_cluster.go"
)
for file in "${FILES_TO_CHECK[@]}"; do
if git diff --name-only remotes/origin/${{ github.base_ref }} remotes/origin/${{ github.head_ref }} | grep -q "$file"; then
SKIP_TESTS="False"
break
fi
done
echo "SKIP_CLUSTER_RESOURCE_TESTS=$SKIP_TESTS"
echo "SKIP_CLUSTER_RESOURCE_TESTS=$SKIP_TESTS" >> $GITHUB_ENV
- env:
TF_ACC: "1"
HYBRID_ORGANIZATION_API_TOKEN: ${{ secrets.DEV_HYBRID_ORGANIZATION_API_TOKEN }}
HYBRID_ORGANIZATION_ID: clx44v7op01nf01m5iohqjkk6
HOSTED_ORGANIZATION_API_TOKEN: ${{ secrets.DEV_HOSTED_ORGANIZATION_API_TOKEN }}
HOSTED_ORGANIZATION_ID: clx42kkcm01fo01o06agtmshg
HOSTED_SCIM_ORGANIZATION_API_TOKEN: ${{ secrets.DEV_HOSTED_SCIM_ORGANIZATION_API_TOKEN }}
HOSTED_SCIM_ORGANIZATION_ID: clz3bcmd3003m01qemptnfenp
HYBRID_CLUSTER_ID: clxkqfzvm001d01ncr9rs80si
HYBRID_DRY_RUN_CLUSTER_ID: clxko4djp008601njcuoxt4z5
HYBRID_NODE_POOL_ID: clxkqfzvm001c01nc1eosyxzg
ASTRO_API_HOST: https://api.astronomer-dev.io
SKIP_CLUSTER_RESOURCE_TESTS: ${{ env.SKIP_CLUSTER_RESOURCE_TESTS }}
HOSTED_TEAM_ID: clx44rvzr01nc01o06pze6qb7
HOSTED_USER_ID: clz3a4ymt004x01on8w5ydq8j
HOSTED_DUMMY_USER_ID: clzawipbm00bm01qw98vzzoca
HOSTED_DEPLOYMENT_ID: cm1zkps2a0cv301ph39benet6
HOSTED_STANDARD_DEPLOYMENT_ID: cm070pg0r00wd01qgnskk0dir
HOSTED_WORKSPACE_ID: clx42sxw501gl01o0gjenthnh
HOSTED_API_TOKEN_ID: clxm4836f00ql01me3nigmcr6
TESTARGS: "-failfast"
run: make testacc
testacc-stage:
# This job runs every Monday.
name: Terraform Provider Acceptance Tests - Stage
needs: build
if: github.event_name == 'schedule' && github.event.schedule == 'cron(30 21 * * 1)'
timeout-minutes: 180 # 3 hours since cluster creation and cluster updates can take a while
strategy:
fail-fast: true
matrix:
terraform:
- latest
provider_version:
- v0.3.1
- v0.2.1
- v0.1.0-alpha
- main
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
ref: ${{ matrix.provider_version }}
- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version-file: 'go.mod'
cache: true
- uses: hashicorp/setup-terraform@651471c36a6092792c552e8b1bef71e592b462d8 # v3.1.1
with:
terraform_version: ${{ matrix.terraform }}
terraform_wrapper: false
- run: go mod download
- env:
TF_ACC: "1"
HYBRID_ORGANIZATION_API_TOKEN: ${{ secrets.STAGE_HYBRID_ORGANIZATION_API_TOKEN }}
HYBRID_ORGANIZATION_ID: clx46ca4y061z01jleyku7sr6
HOSTED_ORGANIZATION_API_TOKEN: ${{ secrets.STAGE_HOSTED_ORGANIZATION_API_TOKEN }}
HOSTED_ORGANIZATION_ID: clx46acvv060e01ilddqlbsmc
HOSTED_SCIM_ORGANIZATION_API_TOKEN: ${{ secrets.STAGE_HOSTED_SCIM_ORGANIZATION_API_TOKEN }}
HOSTED_SCIM_ORGANIZATION_ID: clz3blqb500lh01mtkwu9zk5z
HYBRID_CLUSTER_ID: clxm3xg9e05bl01ixsrhxje4e
HYBRID_DRY_RUN_CLUSTER_ID: clxm3y54805bs01ix5owqhfff
HYBRID_NODE_POOL_ID: clxm3xg9e05bk01ixrqk52cob
ASTRO_API_HOST: https://api.astronomer-stage.io
HOSTED_TEAM_ID: clx486hno068301il306nuhsm
HOSTED_USER_ID: clz3a95hw00j301jj5jfmcgwd
HOSTED_DUMMY_USER_ID: clzawlsb701vv01ikvsqz5mws
HOSTED_DEPLOYMENT_ID: cly6exz4a00zd01k18t5bo1vf
HOSTED_STANDARD_DEPLOYMENT_ID: cm077ee2807g301kpjkqdoc15
HOSTED_WORKSPACE_ID: clx480rvx068u01j9mp7t7fqh
HOSTED_API_TOKEN_ID: clxm46ged05b301neuucdqwox
TESTARGS: "-failfast"
run: make testacc
testacc-dev:
# This job runs every Friday and Tuesday.
name: Terraform Provider Acceptance Tests - Dev
needs: build
if: github.event_name == 'schedule' && (github.event.schedule == 'cron(30 21 * * 2,5)')
timeout-minutes: 180 # 3 hours since cluster creation and cluster updates can take a while
strategy:
fail-fast: true
matrix:
terraform:
- latest
provider_version:
- v0.3.1
- v0.2.1
- v0.1.0-alpha
- main
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
ref: ${{ matrix.provider_version }}
- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version-file: 'go.mod'
cache: true
- uses: hashicorp/setup-terraform@651471c36a6092792c552e8b1bef71e592b462d8 # v3.1.1
with:
terraform_version: ${{ matrix.terraform }}
terraform_wrapper: false
- run: go mod download
- env:
TF_ACC: "1"
HYBRID_ORGANIZATION_API_TOKEN: ${{ secrets.DEV_HYBRID_ORGANIZATION_API_TOKEN }}
HYBRID_ORGANIZATION_ID: clx44v7op01nf01m5iohqjkk6
HOSTED_ORGANIZATION_API_TOKEN: ${{ secrets.DEV_HOSTED_ORGANIZATION_API_TOKEN }}
HOSTED_ORGANIZATION_ID: clx42kkcm01fo01o06agtmshg
HOSTED_SCIM_ORGANIZATION_API_TOKEN: ${{ secrets.DEV_HOSTED_SCIM_ORGANIZATION_API_TOKEN }}
HOSTED_SCIM_ORGANIZATION_ID: clz3bcmd3003m01qemptnfenp
HYBRID_CLUSTER_ID: clxkqfzvm001d01ncr9rs80si
HYBRID_DRY_RUN_CLUSTER_ID: clxko4djp008601njcuoxt4z5
HYBRID_NODE_POOL_ID: clxkqfzvm001c01nc1eosyxzg
ASTRO_API_HOST: https://api.astronomer-dev.io
HOSTED_TEAM_ID: clx44rvzr01nc01o06pze6qb7
HOSTED_USER_ID: clz3a4ymt004x01on8w5ydq8j
HOSTED_DUMMY_USER_ID: clzawipbm00bm01qw98vzzoca
HOSTED_DEPLOYMENT_ID: cm1zkps2a0cv301ph39benet6
HOSTED_STANDARD_DEPLOYMENT_ID: cm070pg0r00wd01qgnskk0dir
HOSTED_WORKSPACE_ID: clx42sxw501gl01o0gjenthnh
HOSTED_API_TOKEN_ID: clxm4836f00ql01me3nigmcr6
TESTARGS: "-failfast"
run: make testacc