HCPCP-1982 Acceptance Test Partitions #8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: TestAcc Platform | |
on: | |
workflow_dispatch: | |
pull_request: | |
# Networking resources still use SDKv2 so we have to target files manually until migrated | |
paths: | |
- 'internal/clients/hvn.go' | |
- 'internal/clients/hvn_route.go' | |
- 'internal/clients/tgw.go' | |
- 'internal/clients/peering.go' | |
- 'internal/providersdkv2/peering*' | |
- 'internal/providersdkv2/resource_aws_network_peering*' | |
- 'internal/providersdkv2/resource_azure_peering*' | |
- 'internal/providersdkv2/resource_aws_transit_gateway_attachment*' | |
- 'internal/providersdkv2/resource_hvn*' | |
jobs: | |
acceptance_tests: | |
name: Acceptance Tests | |
runs-on: ubuntu-latest | |
# environment: testacc-platform | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.HCP_SDK_PIPELINE_TOKEN }} | |
- name: Set up Go | |
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0 | |
with: | |
cache: true | |
go-version-file: 'go.mod' | |
cache-dependency-path: go.sum | |
id: go | |
- name: Install Dependencies | |
env: | |
GOPRIVATE: 'github.com/hashicorp/*' | |
run: | | |
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.53.3 | |
go mod tidy | |
sudo wget https://github.com/jmespath/jp/releases/latest/download/jp-linux-amd64 -O /usr/local/bin/jp | |
sudo chmod +x /usr/local/bin/jp | |
- name: Run 'go mod tidy' | |
run: | | |
make depscheck | |
- name: Get dependencies | |
run: | | |
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.53.3 | |
go mod download | |
- name: Go Build | |
run: | | |
go build -v . | |
- name: Run TestAcc | |
env: | |
TF_ACC: 1 | |
HCP_API_HOST: ${{ secrets.HCP_API_HOST }} | |
HCP_AUTH_URL: ${{ secrets.HCP_AUTH_URL }} | |
HCP_CLIENT_ID: ${{ secrets.HCP_CLIENT_ID }} | |
HCP_CLIENT_SECRET: ${{ secrets.HCP_CLIENT_SECRET }} | |
HCP_ORGANIZATION_ID: ${{ secrets.HCP_ORGANIZATION_ID }} | |
HCP_PROJECT_ID: ${{ secrets.HCP_PROJECT_ID }} | |
AWS_REGION: us-west-1 | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_ROLE_ARN: ${{ secrets.AWS_ROLE_ARN }} | |
AZURE_SUBSCRIPTION_ID: ${{ secrets.ARM_SUBSCRIPTION_ID }} | |
AZURE_TENANT_ID: ${{ secrets.ARM_TENANT_ID }} | |
ARM_SUBSCRIPTION_ID: ${{ secrets.ARM_SUBSCRIPTION_ID }} | |
ARM_CLIENT_ID: ${{ secrets.ARM_CLIENT_ID }} | |
ARM_CLIENT_SECRET: ${{ secrets.ARM_CLIENT_SECRET }} | |
ARM_TENANT_ID: ${{ secrets.ARM_TENANT_ID }} | |
run: | | |
AWS_OUTPUT=$(aws sts assume-role --role-arn $AWS_ROLE_ARN --role-session-name e2e-test --duration-seconds 43200) | |
export AWS_ACCESS_KEY_ID=$(echo $AWS_OUTPUT | jp --unquoted Credentials.AccessKeyId) | |
export AWS_SECRET_ACCESS_KEY=$(echo $AWS_OUTPUT | jp --unquoted Credentials.SecretAccessKey) | |
export AWS_SESSION_TOKEN=$(echo $AWS_OUTPUT | jp --unquoted Credentials.SessionToken) | |
go test ./internal/providersdkv2 \ | |
-v \ | |
-short \ | |
-test.v \ | |
-parallel=10 \ | |
-timeout=360m \ | |
-run=TestAcc_Platform.* \ | |
-coverprofile=testacc-platform.out | |
go tool cover \ | |
-html=testacc-platform.out \ | |
-o testacc-platform.html | |
- name: Upload TestAcc Coverage Artifact | |
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 | |
with: | |
name: Test Coverage | |
path: testacc-platform.html |