@@ -37,7 +37,7 @@ inputs:
37
37
token :
38
38
description : HCP Terraform or Terraform Enterprise token
39
39
required : true
40
- testing-github-token :
40
+ testing_github_token :
41
41
description : The GitHub token used for testing scenarios
42
42
required : false
43
43
enterprise :
@@ -51,6 +51,9 @@ inputs:
51
51
description : The mock run tasks URL to use for testing.
52
52
required : false
53
53
default : " http://testing-mocks.tfe:22180/runtasks/pass"
54
+ test_name :
55
+ description : Name identifier for the test suite being run
56
+ required : true
54
57
55
58
runs :
56
59
using : composite
@@ -82,18 +85,31 @@ runs:
82
85
83
86
- name : Split acceptance tests
84
87
id : test_split
88
+ if : inputs.test_name == 'tests'
85
89
uses : hashicorp-forge/go-test-split-action@796beedbdb3d1bea14cad2d3057bab5c5cf15fe5 # v1.0.2
86
90
with :
87
91
index : ${{ inputs.matrix_index }}
88
92
total : ${{ inputs.matrix_total }}
89
93
junit-summary : ./ci-summary-provider.xml
90
94
list : ${{ inputs.list_tests }}
91
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
107
+
92
108
- name : Run Tests
93
109
shell : bash
94
110
env :
95
- TFE_HOSTNAME : " ${{ inputs.hostname }}"
96
- TFE_TOKEN : " ${{ inputs.token }}"
111
+ TFE_HOSTNAME : ${{ inputs.hostname }}
112
+ TFE_TOKEN : ${{ inputs.token }}
97
113
TFE_ADMIN_CONFIGURATION_TOKEN : ${{ inputs.admin_configuration_token }}
98
114
TFE_ADMIN_PROVISION_LICENSES_TOKEN : ${{ inputs.admin_provision_licenses_token }}
99
115
TFE_ADMIN_SECURITY_MAINTENANCE_TOKEN : ${{ inputs.admin_security_maintenance_token }}
@@ -104,22 +120,27 @@ runs:
104
120
TFE_USER1 : tfe-provider-user1
105
121
TFE_USER2 : tfe-provider-user2
106
122
TF_ACC : " 1"
107
- ENABLE_TFE : " ${{ inputs.enterprise }}"
108
- RUN_TASKS_URL : " ${{ inputs.run_tasks_url }}"
123
+ ENABLE_TFE : ${{ inputs.enterprise }}
124
+ RUN_TASKS_URL : ${{ inputs.run_tasks_url }}
109
125
GITHUB_POLICY_SET_IDENTIFIER : " hashicorp/test-policy-set"
110
126
GITHUB_REGISTRY_MODULE_IDENTIFIER : " hashicorp/terraform-random-module"
111
127
GITHUB_WORKSPACE_IDENTIFIER : " hashicorp/terraform-random-module"
112
128
GITHUB_WORKSPACE_BRANCH : " main"
113
- GITHUB_TOKEN : " ${{ inputs.testing-github-token }}"
129
+ GITHUB_TOKEN : ${{ inputs.testing_github_token }}
114
130
MOD_PROVIDER : github.com/hashicorp/terraform-provider-tfe
115
131
MOD_TFE : github.com/hashicorp/terraform-provider-tfe/internal/provider
116
132
MOD_VERSION : github.com/hashicorp/terraform-provider-tfe/version
117
133
run : |
118
- gotestsum --junitfile summary.xml --format short-verbose -- $MOD_PROVIDER $MOD_TFE $MOD_VERSION -v -timeout=60m -run "${{ steps.test_split.outputs.run }}"
134
+ if [ "${{ inputs.test_name }}" = "tests" ] && [ -n "${{ steps.test_split.outputs.run }}" ]; then
135
+ TEST_PATTERN="${{ steps.test_split.outputs.run }}"
136
+ else
137
+ TEST_PATTERN="${{ inputs.list_tests }}"
138
+ fi
139
+ gotestsum --junitfile summary.xml --format short-verbose -- $MOD_PROVIDER $MOD_TFE $MOD_VERSION -v -timeout=60m -run "$TEST_PATTERN"
119
140
120
141
- name : Upload test artifacts
121
142
uses : actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
122
143
with :
123
- name : junit-test -summary-${{ matrix.index }}
144
+ name : junit-${{ inputs.test_name }} -summary-${{ inputs.matrix_index }}
124
145
path : summary.xml
125
146
retention-days : 1
0 commit comments