Skip to content

Commit c4570f0

Browse files
committed
WIP
1 parent e4f3261 commit c4570f0

File tree

3 files changed

+59
-21
lines changed

3 files changed

+59
-21
lines changed

.github/actions/test-provider-tfe/action.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ inputs:
5151
description: The mock run tasks URL to use for testing.
5252
required: false
5353
default: "http://testing-mocks.tfe:22180/runtasks/pass"
54+
test_name:
55+
description: Name of the test run
56+
required: true
5457

5558
runs:
5659
using: composite
@@ -87,8 +90,20 @@ runs:
8790
index: ${{ inputs.matrix_index }}
8891
total: ${{ inputs.matrix_total }}
8992
junit-summary: ./ci-summary-provider.xml
90-
# When tests are split and run concurrently, lists_tests arg in ci.yml will skip the TestAccTFESAMLSettings_omnibus test suite
9193
list: ${{ inputs.list_tests }}
94+
continue-on-error: true
95+
96+
- name: Fallback test selection
97+
id: test_fallback
98+
shell: bash
99+
run: |
100+
if [ "${{ steps.test_split.outcome }}" = "failure" ] || [ -z "${{ steps.test_split.outputs.run }}" ]; then
101+
echo "Junit splitting failed or no output, using regex fallback"
102+
echo "run=${{ inputs.list_tests }}" >> $GITHUB_OUTPUT
103+
else
104+
echo "Using junit split output"
105+
echo "run=${{ steps.test_split.outputs.run }}" >> $GITHUB_OUTPUT
106+
fi
92107
93108
- name: Run Tests
94109
shell: bash
@@ -116,11 +131,11 @@ runs:
116131
MOD_TFE: github.com/hashicorp/terraform-provider-tfe/internal/provider
117132
MOD_VERSION: github.com/hashicorp/terraform-provider-tfe/version
118133
run: |
119-
gotestsum --junitfile summary.xml --format short-verbose -- $MOD_PROVIDER $MOD_TFE $MOD_VERSION -v -timeout=60m -run "${{ steps.test_split.outputs.run }}"
134+
gotestsum --junitfile summary.xml --format short-verbose -- $MOD_PROVIDER $MOD_TFE $MOD_VERSION -v -timeout=60m -run "${{ steps.test_fallback.outputs.run }}"
120135
121136
- name: Upload test artifacts
122137
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
123138
with:
124-
name: junit-test-summary-${{ matrix.index }}
139+
name: junit-${{ inputs.test_name }}-summary-${{ matrix.index }}
125140
path: summary.xml
126141
retention-days: 1

.github/workflows/ci.yml

Lines changed: 37 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,48 @@ jobs:
1616
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1717
- uses: ./.github/actions/lint-provider-tfe
1818

19-
tests:
20-
name: run
19+
tests:
20+
name: ${{ matrix.test_suite }}
2121
runs-on: ubuntu-latest
22-
timeout-minutes: 60
22+
needs: setup
23+
timeout-minutes: 40
2324
strategy:
2425
fail-fast: false
2526
matrix:
26-
# If you adjust these parameters, also adjust the jrm input files on the "Merge reports" step below
27-
total: [ 1 ]
28-
index: [ 0 ]
27+
include:
28+
# Standard tests with 5-runner matrix
29+
- test_suite: "Standard Tests"
30+
test_name: "tests"
31+
list_tests: "[^(TestAccTFESAMLSettings_omnibus|TestAcc.*_RunDependent)]"
32+
total: 5
33+
index: 0
34+
- test_suite: "Standard Tests"
35+
test_name: "tests"
36+
list_tests: "[^(TestAccTFESAMLSettings_omnibus|TestAcc.*_RunDependent)]"
37+
total: 5
38+
index: 1
39+
- test_suite: "Standard Tests"
40+
test_name: "tests"
41+
list_tests: "[^(TestAccTFESAMLSettings_omnibus|TestAcc.*_RunDependent)]"
42+
total: 5
43+
index: 2
44+
- test_suite: "Standard Tests"
45+
test_name: "tests"
46+
list_tests: "[^(TestAccTFESAMLSettings_omnibus|TestAcc.*_RunDependent)]"
47+
total: 5
48+
index: 3
49+
- test_suite: "Standard Tests"
50+
test_name: "tests"
51+
list_tests: "[^(TestAccTFESAMLSettings_omnibus|TestAcc.*_RunDependent)]"
52+
total: 5
53+
index: 4
54+
# Dependent tests with 1-runner matrix
55+
- test_suite: "Dependent Tests"
56+
test_name: "run-dependent-tests"
57+
list_tests: "TestAcc.*_RunDependent"
58+
total: 1
59+
index: 0
2960
steps:
30-
- name: Fetch Outputs
31-
id: tflocal
32-
uses: hashicorp-forge/terraform-cloud-action/outputs@5583d5f554d268ac91b3c37fd0a5e9da2c78c017 # v1.1.0
33-
with:
34-
token: "${{ secrets.TF_WORKFLOW_TFLOCAL_CLOUD_TFC_TOKEN }}"
35-
organization: hashicorp-v2
36-
workspace: tflocal-terraform-provider-tfe
37-
3861
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3962

4063
- uses: ./.github/actions/test-provider-tfe

internal/provider/resource_tfe_workspace_run_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515
"github.com/hashicorp/terraform-plugin-testing/terraform"
1616
)
1717

18-
func TestAccTFEWorkspaceRun_withApplyOnlyBlock(t *testing.T) {
18+
func TestAccTFEWorkspaceRun_withApplyOnlyBlock_RunDependent(t *testing.T) {
1919
skipUnlessBeta(t)
2020
rInt := rand.New(rand.NewSource(time.Now().UnixNano())).Int()
2121

@@ -65,7 +65,7 @@ func TestAccTFEWorkspaceRun_withApplyOnlyBlock(t *testing.T) {
6565
})
6666
}
6767

68-
func TestAccTFEWorkspaceRun_withBothApplyAndDestroyBlocks(t *testing.T) {
68+
func TestAccTFEWorkspaceRun_withBothApplyAndDestroyBlocks_RunDependent(t *testing.T) {
6969
skipUnlessBeta(t)
7070
rInt := rand.New(rand.NewSource(time.Now().UnixNano())).Int()
7171

@@ -115,7 +115,7 @@ func TestAccTFEWorkspaceRun_withBothApplyAndDestroyBlocks(t *testing.T) {
115115
})
116116
}
117117

118-
func TestAccTFEWorkspaceRun_invalidParams(t *testing.T) {
118+
func TestAccTFEWorkspaceRun_invalidParams_RunDependent(t *testing.T) {
119119
rInt := rand.New(rand.NewSource(time.Now().UnixNano())).Int()
120120

121121
tfeClient, err := getClientUsingEnv()
@@ -156,7 +156,7 @@ func TestAccTFEWorkspaceRun_invalidParams(t *testing.T) {
156156
}
157157
}
158158

159-
func TestAccTFEWorkspaceRun_WhenRunErrors(t *testing.T) {
159+
func TestAccTFEWorkspaceRun_WhenRunErrors_RunDependent(t *testing.T) {
160160
rInt := rand.New(rand.NewSource(time.Now().UnixNano())).Int()
161161

162162
tfeClient, err := getClientUsingEnv()

0 commit comments

Comments
 (0)