Skip to content

Commit 6dbdfa5

Browse files
committed
Add ENABLE_HYOK environment variable to turn on and off HYOK tests
1 parent 656080a commit 6dbdfa5

6 files changed

+16
-3
lines changed

docs/testing.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ these values with the environment variables specified below:
4949
1. `RUN_TASKS_HMAC` - The optional HMAC Key that should be used for Run Task operations. The default is no key.
5050
1. `GITHUB_APP_INSTALLATION_ID` - GitHub App installation internal id in the format `ghain-xxxxxxx`. Required for running any tests that use GitHub App VCS (workspace, policy sets, registry module).
5151
1. `GITHUB_APP_INSTALLATION_NAME` - GitHub App installation name. Required for running tfe_github_app_installation data source test.
52+
1. `ENABLE_HYOK` - Set `ENABLE_HYOK=1` to enable HYOK-related tests.
5253
1. `HYOK_ORGANIZATION_NAME` - Name of an organization entitled to use HYOK. Required to run tests for HYOK resources and data sources.
5354

5455
**Note:** In order to run integration tests for **Paid** features you will need a token `TFE_TOKEN` with HCP Terraform or Terraform Enterprise administrator privileges, otherwise the attempt to upgrade an organization's feature set will fail.

internal/provider/helper_test.go

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

1919
const RunTasksURLEnvName = "RUN_TASKS_URL"
2020
const RunTasksHMACKeyEnvName = "RUN_TASKS_HMAC"
21-
const HYOKOrganizationNameEnvName = "HYOK_ORGANIZATION_NAME"
21+
const EnableHYOKEnvName = "ENABLE_HYOK"
2222

2323
type testClientOptions struct {
2424
defaultOrganization string
@@ -242,8 +242,8 @@ func skipUnlessBeta(t *testing.T) {
242242
func skipUnlessHYOKEnabled(t *testing.T) {
243243
skipIfEnterprise(t)
244244

245-
if value, ok := os.LookupEnv(HYOKOrganizationNameEnvName); !ok || value == "" {
246-
t.Skipf("Skipping tests for HYOK. Set '%s' to enable tests.", HYOKOrganizationNameEnvName)
245+
if value, ok := os.LookupEnv(EnableHYOKEnvName); !ok || value == "" {
246+
t.Skipf("Skipping tests for HYOK. Set '%s' to enable tests.", EnableHYOKEnvName)
247247
}
248248
}
249249

internal/provider/resource_tfe_aws_oidc_configuration_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ func TestAccTFEAWSOIDCConfiguration_basic(t *testing.T) {
1313
skipUnlessHYOKEnabled(t)
1414

1515
orgName := os.Getenv("HYOK_ORGANIZATION_NAME")
16+
if orgName == "" {
17+
t.Skip("Skipping test. Set HYOK_ORGANIZATION_NAME environment to enable test.")
18+
}
1619

1720
originalRoleARN := "arn:aws:iam::123456789012:role/terraform-provider-tfe-example-1"
1821
newRoleARN := "arn:aws:iam::123456789012:role/terraform-provider-tfe-example-2"

internal/provider/resource_tfe_azure_oidc_configuration_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ func TestAccTFEAzureOIDCConfiguration_basic(t *testing.T) {
1313
skipUnlessHYOKEnabled(t)
1414

1515
orgName := os.Getenv("HYOK_ORGANIZATION_NAME")
16+
if orgName == "" {
17+
t.Skip("Skipping test. Set HYOK_ORGANIZATION_NAME environment to enable test.")
18+
}
1619

1720
originalClientID := "client-id-1"
1821
updatedClientID := "client-id-2"

internal/provider/resource_tfe_gcp_oidc_configuration_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ func TestAccTFEGCPOIDCConfiguration_basic(t *testing.T) {
1313
skipUnlessHYOKEnabled(t)
1414

1515
orgName := os.Getenv("HYOK_ORGANIZATION_NAME")
16+
if orgName == "" {
17+
t.Skip("Skipping test. Set HYOK_ORGANIZATION_NAME environment to enable test.")
18+
}
1619

1720
originalServiceAccountEmail := "[email protected]"
1821
updatedServiceAccountEmail := "[email protected]"

internal/provider/resource_tfe_vault_oidc_configuration_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ func TestAccTFEVaultOIDCConfiguration_basic(t *testing.T) {
1313
skipUnlessHYOKEnabled(t)
1414

1515
orgName := os.Getenv("HYOK_ORGANIZATION_NAME")
16+
if orgName == "" {
17+
t.Skip("Skipping test. Set HYOK_ORGANIZATION_NAME environment to enable test.")
18+
}
1619

1720
originalAddress := "https://vault.example.com"
1821
updatedAddress := "https://vault.example2.com"

0 commit comments

Comments
 (0)