Skip to content

Commit 03ff1cb

Browse files
committed
WIP
1 parent e4f3261 commit 03ff1cb

File tree

3 files changed

+79
-30
lines changed

3 files changed

+79
-30
lines changed

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

Lines changed: 0 additions & 1 deletion
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

.github/workflows/ci.yml

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

19-
tests:
20-
name: run
19+
setup:
20+
name: Setup Test Environment
2121
runs-on: ubuntu-latest
22-
timeout-minutes: 60
23-
strategy:
24-
fail-fast: false
25-
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 ]
22+
outputs:
23+
hostname: ${{ steps.tflocal.outputs.hostname }}
24+
token: ${{ steps.tflocal.outputs.token }}
25+
admin_configuration_token: ${{ steps.tflocal.outputs.admin_configuration_token }}
26+
admin_provision_licenses_token: ${{ steps.tflocal.outputs.admin_provision_licenses_token }}
27+
admin_security_maintenance_token: ${{ steps.tflocal.outputs.admin_security_maintenance_token }}
28+
admin_site_admin_token: ${{ steps.tflocal.outputs.admin_site_admin_token }}
29+
admin_subscription_token: ${{ steps.tflocal.outputs.admin_subscription_token }}
30+
admin_support_token: ${{ steps.tflocal.outputs.admin_support_token }}
31+
admin_version_maintenance_token: ${{ steps.tflocal.outputs.admin_version_maintenance_token }}
2932
steps:
3033
- name: Fetch Outputs
31-
id: tflocal
34+
id: tflocal-raw
3235
uses: hashicorp-forge/terraform-cloud-action/outputs@5583d5f554d268ac91b3c37fd0a5e9da2c78c017 # v1.1.0
3336
with:
3437
token: "${{ secrets.TF_WORKFLOW_TFLOCAL_CLOUD_TFC_TOKEN }}"
3538
organization: hashicorp-v2
3639
workspace: tflocal-terraform-provider-tfe
3740

41+
- name: Parse Outputs
42+
id: tflocal
43+
run: |
44+
echo "hostname=${{ fromJSON(steps.tflocal-raw.outputs.workspace-outputs-json).ngrok_domain }}" >> $GITHUB_OUTPUT
45+
echo "token=${{ fromJSON(steps.tflocal-raw.outputs.workspace-outputs-json).tfe_token }}" >> $GITHUB_OUTPUT
46+
echo "admin_configuration_token=${{ fromJSON(steps.tflocal-raw.outputs.workspace-outputs-json).tfe_admin_token_by_role.configuration }}" >> $GITHUB_OUTPUT
47+
echo "admin_provision_licenses_token=${{ fromJSON(steps.tflocal-raw.outputs.workspace-outputs-json).tfe_admin_token_by_role.provision-licenses }}" >> $GITHUB_OUTPUT
48+
echo "admin_security_maintenance_token=${{ fromJSON(steps.tflocal-raw.outputs.workspace-outputs-json).tfe_admin_token_by_role.security-maintenance }}" >> $GITHUB_OUTPUT
49+
echo "admin_site_admin_token=${{ fromJSON(steps.tflocal-raw.outputs.workspace-outputs-json).tfe_admin_token_by_role.site-admin }}" >> $GITHUB_OUTPUT
50+
echo "admin_subscription_token=${{ fromJSON(steps.tflocal-raw.outputs.workspace-outputs-json).tfe_admin_token_by_role.subscription }}" >> $GITHUB_OUTPUT
51+
echo "admin_support_token=${{ fromJSON(steps.tflocal-raw.outputs.workspace-outputs-json).tfe_admin_token_by_role.support }}" >> $GITHUB_OUTPUT
52+
echo "admin_version_maintenance_token=${{ fromJSON(steps.tflocal-raw.outputs.workspace-outputs-json).tfe_admin_token_by_role.version-maintenance }}" >> $GITHUB_OUTPUT
53+
54+
tests:
55+
name: ${{ matrix.test_suite }}
56+
runs-on: ubuntu-latest
57+
needs: setup
58+
timeout-minutes: 40
59+
strategy:
60+
fail-fast: false
61+
matrix:
62+
include:
63+
# Standard tests with 5-runner matrix
64+
- test_suite: "Standard Tests"
65+
list_tests: "[^(TestAccTFESAMLSettings_omnibus|TestAcc.*_RunDependent)]"
66+
total: 5
67+
index: 0
68+
- test_suite: "Standard Tests"
69+
list_tests: "[^(TestAccTFESAMLSettings_omnibus|TestAcc.*_RunDependent)]"
70+
total: 5
71+
index: 1
72+
- test_suite: "Standard Tests"
73+
list_tests: "[^(TestAccTFESAMLSettings_omnibus|TestAcc.*_RunDependent)]"
74+
total: 5
75+
index: 2
76+
- test_suite: "Standard Tests"
77+
list_tests: "[^(TestAccTFESAMLSettings_omnibus|TestAcc.*_RunDependent)]"
78+
total: 5
79+
index: 3
80+
- test_suite: "Standard Tests"
81+
list_tests: "[^(TestAccTFESAMLSettings_omnibus|TestAcc.*_RunDependent)]"
82+
total: 5
83+
index: 4
84+
# Dependent tests with 1-runner matrix
85+
- test_suite: "Dependent Tests"
86+
list_tests: "TestAcc.*_RunDependent"
87+
total: 1
88+
index: 0
89+
steps:
3890
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3991

4092
- uses: ./.github/actions/test-provider-tfe
4193
with:
4294
matrix_index: ${{ matrix.index }}
4395
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 }}
96+
hostname: ${{ needs.setup.outputs.hostname }}
97+
token: ${{ needs.setup.outputs.token }}
4698
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-
# Run terminal cmd 'go help testflag' to learn more about -list flag
55-
# action.yml uses https://github.com/hashicorp-forge/go-test-split-action/blob/main/action.yml to split acceptance tests
56-
# which runs against all tests using the list arg
57-
# lists_tests regex is used to skip the TestAccTFESAMLSettings_omnibus test suite for CI tests only
58-
list_tests: "[^(TestAccTFESAMLSettings_omnibus)]"
99+
admin_configuration_token: ${{ needs.setup.outputs.admin_configuration_token }}
100+
admin_provision_licenses_token: ${{ needs.setup.outputs.admin_provision_licenses_token }}
101+
admin_security_maintenance_token: ${{ needs.setup.outputs.admin_security_maintenance_token }}
102+
admin_site_admin_token: ${{ needs.setup.outputs.admin_site_admin_token }}
103+
admin_subscription_token: ${{ needs.setup.outputs.admin_subscription_token }}
104+
admin_support_token: ${{ needs.setup.outputs.admin_support_token }}
105+
admin_version_maintenance_token: ${{ needs.setup.outputs.admin_version_maintenance_token }}
106+
list_tests: ${{ matrix.list_tests }}
59107

60108
tests-combine-summaries:
61109
name: Combine Test Reports
@@ -73,7 +121,9 @@ jobs:
73121
run: npm install -g junit-report-merger
74122

75123
- 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"
124+
run: |
125+
# Dynamically find all junit XML files and merge them
126+
jrm ./ci-summary-provider.xml junit-*-summary-*/*.xml
77127
78128
- name: Upload test artifacts
79129
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2

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)