Skip to content

Acceptance test

Acceptance test #583

# Run acceptance test every 12 hours
name: Acceptance test
on:
schedule:
- cron: '0 0,12 * * *'
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'info'
type: choice
options:
- info
- warning
- debug
# Testing only needs permissions to read the repository contents.
permissions:
contents: read
jobs:
# Ensure project builds before running testing matrix
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/[email protected]
- uses: actions/[email protected]
with:
go-version-file: 'go.mod'
cache: true
- run: go mod download
- run: go build -v .
- name: Run linters
uses: golangci/[email protected]
with:
version: latest
generate:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: actions/[email protected]
with:
go-version-file: 'go.mod'
cache: true
- run: go generate ./...
- name: git diff
run: |
git diff --compact-summary --exit-code || \
(echo; echo "Unexpected difference in directories after code generation. Run 'go generate ./...' command and commit."; exit 1)
# Run acceptance tests in a matrix with Terraform CLI versions
test:
name: Terraform Provider Acceptance Tests
needs: build
runs-on: ubuntu-latest
timeout-minutes: 65
strategy:
fail-fast: false
matrix:
terraform:
- '1.7.*'
steps:
- uses: actions/[email protected]
- uses: actions/[email protected]
with:
go-version-file: 'go.mod'
cache: true
- uses: hashicorp/[email protected]
with:
terraform_version: ${{ matrix.terraform }}
terraform_wrapper: false
- run: go mod download
- env:
TF_ACC: "1"
TF_LOG: "INFO"
RWC_ENDPOINT: ${{ secrets.RWC_ENDPOINT }}
RWC_API_KEY: ${{ secrets.RWC_API_KEY }}
RWC_API_SECRET: ${{ secrets.RWC_API_SECRET }}
TEST_NAMESPACE: ${{ matrix.terraform }}
TEST_PRIVATE_LINK_TARGET: ${{ secrets.TEST_PRIVATE_LINK_TARGET }}
TEST_BYOC_ENV: ${{ secrets.TEST_BYOC_ENV }}
run: go test -v -timeout 60m github.com/risingwavelabs/terraform-provider-risingwavecloud/internal/provider/acctest
timeout-minutes: 60