Skip to content

Commit 1793b72

Browse files
committed
WIP
1 parent e4f3261 commit 1793b72

File tree

3 files changed

+52
-16
lines changed

3 files changed

+52
-16
lines changed

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ runs:
8787
index: ${{ inputs.matrix_index }}
8888
total: ${{ inputs.matrix_total }}
8989
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
9190
list: ${{ inputs.list_tests }}
9291

9392
- name: Run Tests
@@ -121,6 +120,6 @@ runs:
121120
- name: Upload test artifacts
122121
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
123122
with:
124-
name: junit-test-summary-${{ matrix.index }}
123+
name: junit-${{ matrix.test_name }}-summary-${{ matrix.index }}
125124
path: summary.xml
126125
retention-days: 1

.github/workflows/ci.yml

Lines changed: 47 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,51 @@ jobs:
1717
- uses: ./.github/actions/lint-provider-tfe
1818

1919
tests:
20-
name: run
20+
name: tests
2121
runs-on: ubuntu-latest
22-
timeout-minutes: 60
22+
timeout-minutes: 40
2323
strategy:
2424
fail-fast: false
2525
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 ]
26+
total: [5]
27+
index: [0, 1, 2, 3, 4]
28+
steps:
29+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
30+
31+
- name: Fetch Outputs
32+
id: tflocal
33+
uses: hashicorp-forge/terraform-cloud-action/outputs@5583d5f554d268ac91b3c37fd0a5e9da2c78c017 # v1.1.0
34+
with:
35+
token: "${{ secrets.TF_WORKFLOW_TFLOCAL_CLOUD_TFC_TOKEN }}"
36+
organization: hashicorp-v2
37+
workspace: tflocal-terraform-provider-tfe
38+
39+
40+
- uses: ./.github/actions/test-provider-tfe
41+
with:
42+
matrix_index: ${{ matrix.index }}
43+
matrix_total: ${{ matrix.total }}
44+
hostname: ${{ fromJSON(steps.tflocal.outputs.workspace-outputs-json).ngrok_domain }}
45+
token: ${{ fromJSON(steps.tflocal.outputs.workspace-outputs-json).tfe_token }}
46+
testing-github-token: ${{ secrets.TESTING_GITHUB_TOKEN }}
47+
admin_configuration_token: ${{ fromJSON(steps.tflocal.outputs.workspace-outputs-json).tfe_admin_token_by_role.configuration }}
48+
admin_provision_licenses_token: ${{ fromJSON(steps.tflocal.outputs.workspace-outputs-json).tfe_admin_token_by_role.provision-licenses }}
49+
admin_security_maintenance_token: ${{ fromJSON(steps.tflocal.outputs.workspace-outputs-json).tfe_admin_token_by_role.security-maintenance }}
50+
admin_site_admin_token: ${{ fromJSON(steps.tflocal.outputs.workspace-outputs-json).tfe_admin_token_by_role.site-admin }}
51+
admin_subscription_token: ${{ fromJSON(steps.tflocal.outputs.workspace-outputs-json).tfe_admin_token_by_role.subscription }}
52+
admin_support_token: ${{ fromJSON(steps.tflocal.outputs.workspace-outputs-json).tfe_admin_token_by_role.support }}
53+
admin_version_maintenance_token: ${{ fromJSON(steps.tflocal.outputs.workspace-outputs-json).tfe_admin_token_by_role.version-maintenance }}
54+
list_tests: "[^(TestAccTFESAMLSettings_omnibus|TestAcc.*_RunDependent)]"
55+
56+
run-dependent-tests:
57+
name: run-dependent-tests
58+
runs-on: ubuntu-latest
59+
timeout-minutes: 40
60+
strategy:
61+
fail-fast: false
62+
matrix:
63+
total: [1]
64+
index: [0]
2965
steps:
3066
- name: Fetch Outputs
3167
id: tflocal
@@ -55,7 +91,7 @@ jobs:
5591
# action.yml uses https://github.com/hashicorp-forge/go-test-split-action/blob/main/action.yml to split acceptance tests
5692
# which runs against all tests using the list arg
5793
# lists_tests regex is used to skip the TestAccTFESAMLSettings_omnibus test suite for CI tests only
58-
list_tests: "[^(TestAccTFESAMLSettings_omnibus)]"
94+
list_tests: "TestAcc.*_RunDependent"
5995

6096
tests-combine-summaries:
6197
name: Combine Test Reports
@@ -73,7 +109,8 @@ jobs:
73109
run: npm install -g junit-report-merger
74110

75111
- name: Merge reports
76-
run: jrm ./ci-summary-provider.xml "junit-test-summary-0/*.xml" "junit-test-summary-1/*.xml" "junit-test-summary-2/*.xml" "junit-test-summary-3/*.xml" "junit-test-summary-4/*.xml"
112+
run: |
113+
jrm ./ci-summary-provider.xml junit-tests-summary-*/*.xml
77114
78115
- name: Upload test artifacts
79116
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
@@ -82,14 +119,14 @@ jobs:
82119
path: ./ci-summary-provider.xml
83120

84121
tests-summarize:
85-
name: Summarize Tests
86-
needs: [ tests ]
122+
name: tests-summarize
123+
needs: [ tests, run-dependent-tests ]
87124
runs-on: ubuntu-latest
88125
if: ${{ always() }}
89126
steps:
90127
- name: Check tests Status
91128
run: |
92-
if [ "${{ needs.tests.result }}" = "success" ]; then
129+
if [ "${{ needs.tests.result }}" = "success" ] && [ "${{ needs.run-dependent-tests.result }}" = "success" ]; then
93130
exit 0
94131
fi
95132
exit 1

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)