Skip to content

Commit a194db1

Browse files
committed
Implement skipUnlessHYOKEnabled function
1 parent c7e775b commit a194db1

5 files changed

+13
-20
lines changed

internal/provider/helper_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818

1919
const RunTasksURLEnvName = "RUN_TASKS_URL"
2020
const RunTasksHMACKeyEnvName = "RUN_TASKS_HMAC"
21+
const HYOKOrganizationNameEnvName = "HYOK_ORGANIZATION_NAME"
2122

2223
type testClientOptions struct {
2324
defaultOrganization string
@@ -238,6 +239,14 @@ func skipUnlessBeta(t *testing.T) {
238239
}
239240
}
240241

242+
func skipUnlessHYOKEnabled(t *testing.T) {
243+
skipIfEnterprise(t)
244+
245+
if value, ok := os.LookupEnv(HYOKOrganizationNameEnvName); !ok || value == "" {
246+
t.Skipf("Skipping tests for HYOK. Set '%s' to enable tests.", HYOKOrganizationNameEnvName)
247+
}
248+
}
249+
241250
// Temporarily skip a test that may be experiencing API errors. This method
242251
// purposefully errors after the set date to remind contributors to remove this check
243252
// and verify that the API errors are no longer occurring.

internal/provider/resource_tfe_aws_oidc_configuration_test.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,10 @@ import (
1010
)
1111

1212
func TestAccTFEAWSOIDCConfiguration_basic(t *testing.T) {
13-
skipIfEnterprise(t)
13+
skipUnlessHYOKEnabled(t)
1414

1515
orgName := os.Getenv("HYOK_ORGANIZATION_NAME")
1616

17-
if orgName == "" {
18-
t.Skip("Test skipped: HYOK_ORGANIZATION_NAME environment variable is not set")
19-
}
20-
2117
originalRoleARN := "arn:aws:iam::123456789012:role/terraform-provider-tfe-example-1"
2218
newRoleARN := "arn:aws:iam::123456789012:role/terraform-provider-tfe-example-2"
2319

internal/provider/resource_tfe_azure_oidc_configuration_test.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,10 @@ import (
1010
)
1111

1212
func TestAccTFEAzureOIDCConfiguration_basic(t *testing.T) {
13-
skipIfEnterprise(t)
13+
skipUnlessHYOKEnabled(t)
1414

1515
orgName := os.Getenv("HYOK_ORGANIZATION_NAME")
1616

17-
if orgName == "" {
18-
t.Skip("Test skipped: HYOK_ORGANIZATION_NAME environment variable is not set")
19-
}
20-
2117
originalClientID := "client-id-1"
2218
updatedClientID := "client-id-2"
2319
originalSubscriptionID := "subscription-id-1"

internal/provider/resource_tfe_gcp_oidc_configuration_test.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,10 @@ import (
1010
)
1111

1212
func TestAccTFEGCPOIDCConfiguration_basic(t *testing.T) {
13-
skipIfEnterprise(t)
13+
skipUnlessHYOKEnabled(t)
1414

1515
orgName := os.Getenv("HYOK_ORGANIZATION_NAME")
1616

17-
if orgName == "" {
18-
t.Skip("Test skipped: HYOK_ORGANIZATION_NAME environment variable is not set")
19-
}
20-
2117
originalServiceAccountEmail := "[email protected]"
2218
updatedServiceAccountEmail := "[email protected]"
2319
originalProjectNumber := "123456789012"

internal/provider/resource_tfe_vault_oidc_configuration_test.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,10 @@ import (
1010
)
1111

1212
func TestAccTFEVaultOIDCConfiguration_basic(t *testing.T) {
13-
skipIfEnterprise(t)
13+
skipUnlessHYOKEnabled(t)
1414

1515
orgName := os.Getenv("HYOK_ORGANIZATION_NAME")
1616

17-
if orgName == "" {
18-
t.Skip("Test skipped: HYOK_ORGANIZATION_NAME environment variable is not set")
19-
}
20-
2117
originalAddress := "https://vault.example.com"
2218
updatedAddress := "https://vault.example2.com"
2319
originalRoleName := "role-name-1"

0 commit comments

Comments
 (0)