Skip to content

Commit 51edf1e

Browse files
committed
wip
1 parent e4f3261 commit 51edf1e

File tree

3 files changed

+57
-11
lines changed

3 files changed

+57
-11
lines changed

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

Lines changed: 5 additions & 2 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
@@ -76,7 +79,7 @@ runs:
7679
uses: dawidd6/action-download-artifact@09f2f74827fd3a8607589e5ad7f9398816f540fe # v3.1.4
7780
with:
7881
workflow_conclusion: success
79-
name: junit-test-summary
82+
name: junit-${{ inputs.test_name }}-summary
8083
if_no_artifact_found: warn
8184
branch: main
8285

@@ -121,6 +124,6 @@ runs:
121124
- name: Upload test artifacts
122125
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
123126
with:
124-
name: junit-test-summary-${{ matrix.index }}
127+
name: junit-${{ inputs.test_name }}-summary-${{ matrix.index }}
125128
path: summary.xml
126129
retention-days: 1

.github/workflows/ci.yml

Lines changed: 48 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,49 @@ jobs:
1919
tests:
2020
name: run
2121
runs-on: ubuntu-latest
22-
timeout-minutes: 60
22+
timeout-minutes: 40
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: [ 5 ]
28+
index: [ 0, 1, 2, 3, 4 ]
29+
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+
38+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
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+
# 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 and any test matching TestAcc*_RunDependent for CI tests only
58+
list_tests: "[^(TestAccTFESAMLSettings_omnibus|TestAcc.*_RunDependent)]"
59+
test_name: "tests"
60+
61+
run-dependent-tests:
62+
name: run
63+
runs-on: ubuntu-latest
64+
timeout-minutes: 40
2365
strategy:
2466
fail-fast: false
2567
matrix:
@@ -54,12 +96,13 @@ jobs:
5496
# Run terminal cmd 'go help testflag' to learn more about -list flag
5597
# action.yml uses https://github.com/hashicorp-forge/go-test-split-action/blob/main/action.yml to split acceptance tests
5698
# 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+
# lists_tests regex is used to include the any test matching TestAcc*_RunDependent for CI tests only
100+
list_tests: "TestAcc.*_RunDependent"
101+
test_name: "run-dependent-tests"
59102

60103
tests-combine-summaries:
61104
name: Combine Test Reports
62-
needs: [ tests ]
105+
needs: [ tests, run-dependent-tests ]
63106
runs-on: ubuntu-latest
64107
steps:
65108
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
@@ -73,7 +116,7 @@ jobs:
73116
run: npm install -g junit-report-merger
74117

75118
- 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"
119+
run: jrm ./ci-summary-provider.xml "junit-tests-summary-0/*.xml" "junit-tests-summary-1/*.xml" "junit-tests-summary-2/*.xml" "junit-tests-summary-3/*.xml" "junit-tests-summary-4/*.xml" "junit-tests-summary/*.xml" "junit-run-dependent-tests-summary-0/*.xml"
77120

78121
- name: Upload test artifacts
79122
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)