test: enable dynamic name (PSKD-1363) #76
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: Default Plan Unit Tests | |
on: | |
push: | |
branches: ['**'] # '*' will cause the workflow to run on all commits to all branches. | |
jobs: | |
go-tests: | |
name: Default Plan Unit Tests | |
runs-on: ubuntu-latest | |
environment: terraformSecrets | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: 1.22 | |
cache: false | |
- uses: hashicorp/setup-terraform@v2 | |
with: | |
terraform_version: 1.9.6 | |
terraform_wrapper: false | |
- name: Install terratest_log_parser | |
run: | | |
go install github.com/gruntwork-io/terratest/cmd/terratest_log_parser@latest | |
- name: Download Go Modules | |
working-directory: test | |
run: go mod download | |
- name: Set ssh keys for github remote download | |
working-directory: test | |
run: | | |
mkdir ~/.ssh | |
echo "${{ secrets.SSH_GITHUB }}" > ~/.ssh/id_rsa.pub | |
chmod 600 ~/.ssh/id_rsa.pub | |
- name: Run Tests | |
working-directory: test | |
run: | | |
go test ./... -timeout 30m | tee test_output.log | |
terratest_log_parser -testlog test_output.log -outputdir test_output | |
env: | |
# TF ENVIRONMENT | |
TF_VAR_subscription_id: "${{ secrets.TF_VAR_SUBSCRIPTION_ID }}" | |
TF_VAR_tenant_id: "${{ secrets.TF_VAR_TENANT_ID }}" | |
TF_VAR_client_id: "${{ secrets.TF_VAR_CLIENT_ID }}" | |
TF_VAR_client_secret: "${{ secrets.TF_VAR_CLIENT_SECRET }}" | |
- name: Show Test Results log | |
working-directory: test | |
run: | | |
cat test_output/summary.log | |
- name: Check Results | |
working-directory: test/test_output | |
run: | | |
go run parse_results.go |