Skip to content

Commit

Permalink
[TF-10363] skip SAML resource tests when CI runs (#1127)
Browse files Browse the repository at this point in the history
* skip SAML tests when CI runs

* set default val for new input

* prev regex excluded all tests, fix

* comment solution for context

* add comment in TestAccTFESAMLSettings_omnibus file noting new changes to when tests run
  • Loading branch information
laurenolivia committed Nov 6, 2023
1 parent 00b4cd1 commit 8c7510f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/actions/test-provider-tfe/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ inputs:
enterprise:
description: Test enterprise features (`hostname` must be running in ON_PREM mode)
required: false
list_tests:
description: Accepts regex rules to either include or exclude specific tests from running in either CI or nightly workflows.
required: false
default: "."

runs:
using: composite
Expand Down Expand Up @@ -79,6 +83,8 @@ runs:
index: ${{ inputs.matrix_index }}
total: ${{ inputs.matrix_total }}
junit-summary: ./ci-summary-provider.xml
# When tests are split and run concurrently, lists_tests arg in ci.yml will skip the TestAccTFESAMLSettings_omnibus test suite
list: ${{ inputs.list_tests }}

- name: Run Tests
shell: bash
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ jobs:
admin_subscription_token: ${{ fromJSON(steps.tflocal.outputs.workspace-outputs-json).tfe_admin_token_by_role.subscription }}
admin_support_token: ${{ fromJSON(steps.tflocal.outputs.workspace-outputs-json).tfe_admin_token_by_role.support }}
admin_version_maintenance_token: ${{ fromJSON(steps.tflocal.outputs.workspace-outputs-json).tfe_admin_token_by_role.version-maintenance }}
# Run terminal cmd 'go help testflag' to learn more about -list flag
# action.yml uses https://github.com/hashicorp-forge/go-test-split-action/blob/main/action.yml to split acceptance tests
# which runs against all tests using the list arg
# lists_tests regex is used to skip the TestAccTFESAMLSettings_omnibus test suite for CI tests only
list_tests: "[^(TestAccTFESAMLSettings_omnibus)]"

tests-combine-summaries:
name: Combine Test Reports
Expand Down
3 changes: 3 additions & 0 deletions internal/provider/resource_tfe_saml_settings_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ const testResourceName = "tfe_saml_settings.foobar"
// different test runner partitions in CI, then they will inevitably flake, as
// tests running concurrently in different containers will be competing to set
// the same shared global state in the TFE instance.

// TestAccTFESAMLSettings_omnibus test suite is skipped in the CI, and will only run in TFE Nightly workflow
// Should this test name ever change, you will also need to update the regex in ci.yml
func TestAccTFESAMLSettings_omnibus(t *testing.T) {
t.Run("basic SAML settings resource", func(t *testing.T) {
s := tfe.AdminSAMLSetting{
Expand Down

0 comments on commit 8c7510f

Please sign in to comment.