feat: more_tests (#85)
Some checks failed
Publish / Check GoReleaser config (push) Successful in 7s
Publish / Publish provider (push) Successful in 7m41s
CI Workflow / Check GoReleaser config (pull_request) Successful in 6s
CI Workflow / Prepare GO cache (pull_request) Successful in 10m18s
CI Workflow / Test readiness for publishing provider (pull_request) Has been cancelled
CI Workflow / Code coverage report (pull_request) Has been cancelled
CI Workflow / CI run build and linting (pull_request) Has been cancelled
CI Workflow / CI run tests (pull_request) Has been cancelled
TF Acceptance Tests Workflow / Acceptance Tests (pull_request) Failing after 26m13s

## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Reviewed-on: #85
This commit is contained in:
Marcel_Henselin 2026-03-17 15:02:08 +00:00
parent 3790894563
commit dd77da71dd
Signed by: tf-provider.git.onstackit.cloud
GPG key ID: 6D7E8A1ED8955A9C
37 changed files with 2473 additions and 1742 deletions

View file

@ -2,9 +2,14 @@ name: Acceptance Testing
description: "Acceptance Testing pipeline"
inputs:
tf_debug:
description: "enable terraform debug logs"
default: 'false'
required: true
test_timeout_string:
description: "string that determines the timeout (default: 45m)"
default: '45m'
default: '90m'
required: true
go-version:
@ -141,6 +146,12 @@ runs:
${{ steps.goenv.outputs.gomodcache }}
key: ${{ runner.os }}-gopkg
- name: Define service account file path variable
id: service_account
shell: bash
run: |
echo "safilepath=${PWD}/stackit/${{ inputs.service_account_json_file_path }}" >> "$GITHUB_OUTPUT"
- name: Creating service_account file from json input
if: inputs.service_account_json_content != ''
shell: bash
@ -192,6 +203,11 @@ runs:
echo "::group::go test file"
set -e
set -o pipefail
if [[ "${{ inputs.tf_debug }}" == "true" ]]; then
TF_LOG=INFO
export TF_LOG
fi
echo "Running acceptance tests for the terraform provider"
cd stackit || exit 1
@ -204,7 +220,7 @@ runs:
TF_ACC_KEK_KEY_RING_ID=${TF_ACC_KEK_KEY_RING_ID} \
TF_ACC_KEK_KEY_VERSION=${TF_ACC_KEK_KEY_VERSION} \
TF_ACC_KEK_SERVICE_ACCOUNT=${TF_ACC_KEK_SERVICE_ACCOUNT} \
go test ${{ inputs.test_file }} -count=1 -timeout=${{ inputs.test_timeout_string }}
go test -v ${{ inputs.test_file }} -timeout=${{ inputs.test_timeout_string }}
echo "::endgroup::"
env:
TF_ACC_PROJECT_ID: ${{ inputs.project_id }}
@ -215,6 +231,7 @@ runs:
TF_ACC_KEK_KEY_VERSION: ${{ inputs.tf_acc_kek_key_version }}
TF_ACC_KEK_SERVICE_ACCOUNT: ${{ inputs.tf_acc_kek_service_account }}
# does not work correctly
# - name: Run test action
# if: ${{ inputs.test_file == '' }}
# env:
@ -226,19 +243,25 @@ runs:
# TF_ACC_KEK_KEY_RING_ID: ${{ inputs.tf_acc_kek_key_ring_id }}
# TF_ACC_KEK_KEY_VERSION: ${{ inputs.tf_acc_kek_key_version }}
# TF_ACC_KEK_SERVICE_ACCOUNT: ${{ inputs.tf_acc_kek_service_account }}
# TF_ACC_SERVICE_ACCOUNT_FILE: "${PWD}/${{ inputs.service_account_json_file_path }}"
# uses: robherley/go-test-action@v0.1.0
# TF_ACC_SERVICE_ACCOUNT_FILE: ${{ steps.service_account.outputs.safile }}
# uses: robherley/go-test-action@v0
# with:
# testArguments: "./... -timeout 45m"
# testArguments: "./... -timeout ${{ inputs.test_timeout_string }}"
# moduleDirectory: "stackit"
- name: Run acceptance tests
if: ${{ inputs.test_file == '' }}
shell: bash
run: |
echo "::group::go test all"
set -e
set -e
set -o pipefail
if [[ "${{ inputs.tf_debug }}" == "true" ]]; then
TF_LOG=INFO
export TF_LOG
fi
echo "Running acceptance tests for the terraform provider"
cd stackit || exit 1
TF_ACC=1 \
@ -250,7 +273,7 @@ runs:
TF_ACC_KEK_KEY_RING_ID=${TF_ACC_KEK_KEY_RING_ID} \
TF_ACC_KEK_KEY_VERSION=${TF_ACC_KEK_KEY_VERSION} \
TF_ACC_KEK_SERVICE_ACCOUNT=${TF_ACC_KEK_SERVICE_ACCOUNT} \
go test ./... -count=1 -timeout=${{ inputs.test_timeout_string }}
go test -v ./... -timeout=${{ inputs.test_timeout_string }}
echo "::endgroup::"
env:
TF_ACC_PROJECT_ID: ${{ inputs.project_id }}

View file

@ -2,6 +2,7 @@ name: CI Workflow
on:
pull_request:
types: [ opened, synchronize, reopened ]
branches:
- alpha
- main
@ -218,11 +219,21 @@ jobs:
run: go mod tidy
- name: Testing
if: ${{ github.event_name != 'pull_request' }}
run: |
unset TF_ACC
TF_ACC_SERVICE_ACCOUNT_FILE=~/.service_account.json
export TF_ACC_SERVICE_ACCOUNT_FILE
make test
- name: Testing with coverage
if: ${{ github.event_name == 'pull_request' }}
run: |
unset TF_ACC
TF_ACC_SERVICE_ACCOUNT_FILE=~/.service_account.json
export TF_ACC_SERVICE_ACCOUNT_FILE
make coverage
# - name: Acceptance Testing
# env:
# TF_ACC: "1"
@ -232,20 +243,20 @@ jobs:
# export TF_ACC_SERVICE_ACCOUNT_FILE
# make test-acceptance-tf
- name: Run Test
if: ${{ github.event_name == 'pull_request' }}
uses: ./.github/actions/acc_test
with:
go-version: ${{ env.GO_VERSION }}
project_id: ${{ vars.TF_ACC_PROJECT_ID }}
region: ${{ vars.TF_ACC_REGION }}
service_account_json_content_b64: "${{ secrets.TF_ACC_SERVICE_ACCOUNT_JSON_B64 }}"
project_user_email: ${{ vars.TEST_PROJECT_USER_EMAIL }}
tf_acc_kek_key_id: ${{ vars.TF_ACC_KEK_KEY_ID }}
tf_acc_kek_key_ring_id: ${{ vars.TF_ACC_KEK_KEY_RING_ID }}
tf_acc_kek_key_version: ${{ vars.TF_ACC_KEK_KEY_VERSION }}
tf_acc_kek_service_account: ${{ vars.TF_ACC_KEK_SERVICE_ACCOUNT }}
# service_account_json_file_path: "~/service_account.json"
# - name: Run Acceptance Test
# if: ${{ github.event_name == 'pull_request' }}
# uses: ./.github/actions/acc_test
# with:
# go-version: ${{ env.GO_VERSION }}
# project_id: ${{ vars.TF_ACC_PROJECT_ID }}
# region: ${{ vars.TF_ACC_REGION }}
# service_account_json_content_b64: "${{ secrets.TF_ACC_SERVICE_ACCOUNT_JSON_B64 }}"
# project_user_email: ${{ vars.TEST_PROJECT_USER_EMAIL }}
# tf_acc_kek_key_id: ${{ vars.TF_ACC_KEK_KEY_ID }}
# tf_acc_kek_key_ring_id: ${{ vars.TF_ACC_KEK_KEY_RING_ID }}
# tf_acc_kek_key_version: ${{ vars.TF_ACC_KEK_KEY_VERSION }}
# tf_acc_kek_service_account: ${{ vars.TF_ACC_KEK_SERVICE_ACCOUNT }}
# # service_account_json_file_path: "~/service_account.json"
- name: Check coverage threshold
shell: bash

View file

@ -12,8 +12,10 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Self-hosted Renovate
uses: renovatebot/github-action@v41.0.0
uses: renovatebot/github-action@v46.1.4
with:
configurationFile: .github/renovate.json
token: ${{ secrets.RENOVATE_TOKEN }}
# token: ${{ secrets.RENOVATE_TOKEN }}
token: ${{ env.FORGEJO_TOKEN }}

View file

@ -1,10 +1,24 @@
name: TF Acceptance Tests Workflow
on:
pull_request:
types: [opened, synchronize, reopened]
branches:
- alpha
- main
push:
branches:
- master
workflow_dispatch:
inputs:
enable_debug:
description: "enable terraform debug logs"
default: 'false'
required: true
test_timeout_string:
description: "string that determines the timeout (default: 45m)"
default: '90m'
required: true
jobs:
acc_test:
@ -14,7 +28,8 @@ jobs:
- name: Checkout
uses: actions/checkout@v6
- name: Run Test
- name: Run Test (workflow dispatch)
if: ${{ github.event_name == 'workflow_dispatch' }}
uses: ./.github/actions/acc_test
with:
go-version: ${{ env.GO_VERSION }}
@ -26,4 +41,20 @@ jobs:
tf_acc_kek_key_ring_id: ${{ vars.TF_ACC_KEK_KEY_RING_ID }}
tf_acc_kek_key_version: ${{ vars.TF_ACC_KEK_KEY_VERSION }}
tf_acc_kek_service_account: ${{ vars.TF_ACC_KEK_SERVICE_ACCOUNT }}
# service_account_json_file_path: "~/service_account.json"
tf_debug: ${{ inputs.enable_debug }}
test_timeout_string: ${{ inputs.test_timeout_string }}
- name: Run Test (automatic)
if: ${{ github.event_name != 'workflow_dispatch' }}
uses: ./.github/actions/acc_test
with:
go-version: ${{ env.GO_VERSION }}
project_id: ${{ vars.TF_ACC_PROJECT_ID }}
region: 'eu01'
service_account_json_content_b64: "${{ secrets.TF_ACC_SERVICE_ACCOUNT_JSON_B64 }}"
project_user_email: ${{ vars.TEST_PROJECT_USER_EMAIL }}
tf_acc_kek_key_id: ${{ vars.TF_ACC_KEK_KEY_ID }}
tf_acc_kek_key_ring_id: ${{ vars.TF_ACC_KEK_KEY_RING_ID }}
tf_acc_kek_key_version: ${{ vars.TF_ACC_KEK_KEY_VERSION }}
tf_acc_kek_service_account: ${{ vars.TF_ACC_KEK_SERVICE_ACCOUNT }}
tf_debug: ${{ inputs.enable_debug }}