Skip to content

Commit

Permalink
Moving export tests into a new workflow job
Browse files Browse the repository at this point in the history
  • Loading branch information
charliecon committed Jan 5, 2024
1 parent c6d7902 commit acfda13
Show file tree
Hide file tree
Showing 6 changed files with 1,168 additions and 13 deletions.
112 changes: 112 additions & 0 deletions .github/workflows/export-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# This GitHub action runs your tests for each commit push and/or PR. Optionally
# you can turn it on using a cron schedule for regular testing.
#
name: Export Tests
on:
push:
paths-ignore:
- 'README.md'
# Run daily tests
schedule:
- cron: '0 10 * * *'
jobs:
# ensure the code builds...
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 5
steps:

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.20'
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v4

- name: Get dependencies
run: |
go mod download
- name: Build
run: |
go build -v .
# run acceptance tests in a matrix with Terraform core versions
test:
name: Export Tests
needs: build
runs-on: ubuntu-latest
timeout-minutes: 80
strategy:
fail-fast: false
max-parallel: 2
matrix:
# list whatever Terraform versions here you would like to support
terraform:
- '1.1.7'
steps:

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.20'
id: go

- name: Setup Terraform CLI
uses: hashicorp/setup-terraform@v3.0.0
with:
terraform_version: ${{ matrix.terraform }}

- name: Check out code into the Go module directory
uses: actions/checkout@v4

- name: Get dependencies
run: |
go mod download
- name: Export TF acceptance tests
timeout-minutes: 80
env:
TF_ACC: "1"
TF_LOG: "DEBUG"
TF_LOG_PATH: "../test.log"
TF_ACC_TERRAFORM_VERSION: ${{ matrix.terraform }}

GENESYSCLOUD_OAUTHCLIENT_ID: ${{ secrets.TEST_GENESYSCLOUD_OAUTHCLIENT_ID }}
GENESYSCLOUD_OAUTHCLIENT_SECRET: ${{ secrets.TEST_GENESYSCLOUD_OAUTHCLIENT_SECRET }}
GENESYSCLOUD_REGION: "us-east-1"
GENESYSCLOUD_SDK_DEBUG: "true"
GENESYSCLOUD_TOKEN_POOL_SIZE: 20
run: |
if [ "$TF_ACC_TERRAFORM_VERSION" == "0.14.7" ]; then
sleep 300 # This avoids conflicts with the API and other related issues e.g. too many routing email domains
fi
go test -timeout 80m -v -cover ./genesyscloud/tfexporter/... -coverprofile=export_coverage.out
go tool cover -html=export_coverage.out -o export_cover.html
- name: 'Upload Export Result'
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: export-result ${{ matrix.terraform }}
path: ./.terraform/
retention-days: 5

- name: 'Upload Logs'
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: logs ${{ matrix.terraform }}
path: ./export_test.log
retention-days: 5

- name: 'Upload SDK Log'
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: sdk_log ${{ matrix.terraform }}
path: ./genesyscloud/export_sdk_debug.log
retention-days: 5
12 changes: 2 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,8 @@ jobs:
if [ "$TF_ACC_TERRAFORM_VERSION" == "0.14.7" ]; then
sleep 300 # This avoids conflicts with the API and other related issues e.g. too many routing email domains
fi
go test -timeout 80m -v -cover ./genesyscloud/... -parallel 20 -coverprofile=coverage.out
go tool cover -html coverage.out cover.html
- name: 'Upload Export Result'
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: export-result ${{ matrix.terraform }}
path: ./.terraform/
retention-days: 5
go test -timeout 80m -v -cover ./genesyscloud/... -parallel 20 -coverprofile=coverage.out -skip="^(TestAccResourceTfExport).*$"
go tool cover -html coverage.out -o cover.html
- name: 'Upload Logs'
if: ${{ always() }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
inboundCall:
name: test flow 07a3ab5c-062c-4218-853c-1a535e3c17a3
name: test flow 347afe58-746d-48e9-88a7-dfef0c7e9514
defaultLanguage: en-us
startUpRef: ./menus/menu[mainMenu]
initialGreeting:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
workflow:
name: terraform-provider-test-b36864d6-392e-45f0-b2d2-a96c02f25f84
division: Home0349a372-0480-4879-b98e-8aace58b1bb7
name: terraform-provider-test-97450725-2830-42de-a230-5d763ecce39f
division: New Home
startUpRef: "/workflow/states/state[Initial State_10]"
defaultLanguage: en-us
variables:
Expand Down
Loading

0 comments on commit acfda13

Please sign in to comment.