Skip to content

Tests

Tests #1497

Workflow file for this run

name: Tests
on:
push:
# Run regular tests to confirm that no upstream API changes have broken the provider
schedule:
- cron: '0 7 * * *'
jobs:
build:
name: Build and lint
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '>=1.21.5'
check-latest: true
cache: false
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Get dependencies
run: |
go mod download
- name: Lint
uses: golangci/[email protected]
with:
args: -v --timeout 1h ./...
skip-cache: true
- name: Check for errors
run: |
make errcheck
- name: Build
run: |
go build -v .
generate-doc:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v5
with:
go-version: '>=1.21.5'
check-latest: true
cache: false
- uses: actions/checkout@v4
- run: go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs
- name: git diff
run: |
git diff --compact-summary --exit-code || \
(echo; echo "Uncommitted doc updated detected"; exit 1)
test:
name: Matrix Test
needs: build
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
terraform:
- '1.3.*'
- '1.4.*'
- '1.5.*'
- '1.6.*'
steps:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '>=1.21.5'
check-latest: true
cache: false
id: go
- uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ matrix.terraform }}
terraform_wrapper: false
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Get dependencies
run: |
go mod download
- name: TF acceptance tests (staging backend)
timeout-minutes: 60
env:
TF_ACC: "1" # Enables provider acceptance test mode
TF_VAR_cloudtruth_api_key: ${{ secrets.STAGING_ACCEPTANCE_TEST_TOKEN }}
CLOUDTRUTH_API_KEY: ${{ secrets.STAGING_ACCEPTANCE_TEST_TOKEN }} # for tests without provider defs
CLOUDTRUTH_PROJECT: AcceptanceTest
CLOUDTRUTH_ENVIRONMENT: default
CLOUDTRUTH_DOMAIN: api.staging.cloudtruth.io
run: |
go test -timeout 60m -v -cover ./cloudtruth
- name: TF acceptance tests (prod backend)
timeout-minutes: 60
env:
TF_ACC: "1" # Enables provider acceptance test mode
TF_VAR_cloudtruth_api_key: ${{ secrets.ACCEPTANCE_TEST_TOKEN }}
CLOUDTRUTH_API_KEY: ${{ secrets.ACCEPTANCE_TEST_TOKEN }} # for tests without provider defs
CLOUDTRUTH_PROJECT: AcceptanceTest
CLOUDTRUTH_ENVIRONMENT: default
run: |
go test -timeout 60m -v -cover ./cloudtruth