diff --git a/.github/actions/test-go-tfe/action.yml b/.github/actions/test-go-tfe/action.yml index 34ec1b28c..19081eea3 100644 --- a/.github/actions/test-go-tfe/action.yml +++ b/.github/actions/test-go-tfe/action.yml @@ -110,6 +110,8 @@ runs: GITHUB_POLICY_SET_IDENTIFIER: "svc-team-tf-core-cloud/test-policy-set" GITHUB_REGISTRY_MODULE_IDENTIFIER: "svc-team-tf-core-cloud/terraform-random-module" GITHUB_REGISTRY_NO_CODE_MODULE_IDENTIFIER: "hashicorp/terraform-random-no-code-module" + GITHUB_STACK_IDENTIFIER: "svc-team-tf-core-cloud/tf-stacks-pet-nulls" + GITHUB_STACK_REPO_BRANCH: "diags" OAUTH_CLIENT_GITHUB_TOKEN: "${{ inputs.oauth-client-github-token }}" SKIP_HYOK_INTEGRATION_TESTS: "${{ inputs.skip-hyok-integration-tests }}" HYOK_ORGANIZATION_NAME: "${{ inputs.hyok-organization-name }}" diff --git a/CHANGELOG.md b/CHANGELOG.md index 3acf0f87b..f93050d0c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ ## Enhancements * Adds the `Size` field to `StateVersion` by @shaunakone [#1280](https://github.com/hashicorp/go-tfe/pull/1280) * Upgrade go version from `1.24` to `1.25` by @uk1288 [#1297](https://github.com/hashicorp/go-tfe/pull/1297) +* Unskip stacks integration tests and remove diagnostics#acknowledge in preparation for stacks tfe release by @aaabdelgany [#1298](https://github.com/hashicorp/go-tfe/pull/1298) # v1.101.0 diff --git a/docs/TESTS.md b/docs/TESTS.md index d2830da45..b913c7a6c 100644 --- a/docs/TESTS.md +++ b/docs/TESTS.md @@ -56,6 +56,8 @@ Tests are run against an actual backend so they require a valid backend address $ GITHUB_APP_INSTALLATION_ID=ghain-xxxx TFE_ADDRESS= https://tfe.local TFE_TOKEN=xxx GITHUB_POLICY_SET_IDENTIFIER=username/repository GITHUB_REGISTRY_MODULE_IDENTIFIER=username/repository go test -run "(GHA|GithubApp)" -v ./... ``` 8. `GITHUB_REGISTRY_NO_CODE_MODULE_IDENTIFIER` - Required for running tests for workspaces using no-code modules. +9. `GITHUB_STACK_IDENTIFIER` - Required for running tests against vcs backed stacks. +10. `GITHUB_STACK_REPO_BRANCH` - Required for running tests against specific branches of vcs backed stacks. ## 3. Make sure run queue settings are correct diff --git a/stack_configuration_integration_test.go b/stack_configuration_integration_test.go index d5ef55383..f681591f2 100644 --- a/stack_configuration_integration_test.go +++ b/stack_configuration_integration_test.go @@ -14,7 +14,6 @@ import ( func TestStackConfigurationList(t *testing.T) { t.Parallel() - skipUnlessBeta(t) client := testClient(t) ctx := context.Background() @@ -28,7 +27,7 @@ func TestStackConfigurationList(t *testing.T) { stack, err := client.Stacks.Create(ctx, StackCreateOptions{ Name: "test-stack-list", VCSRepo: &StackVCSRepoOptions{ - Identifier: "hashicorp-guides/pet-nulls-stack", + Identifier: stackVCSRepoIdentifier(t), OAuthTokenID: oauthClient.OAuthTokens[0].ID, }, Project: &Project{ @@ -82,7 +81,6 @@ func TestStackConfigurationList(t *testing.T) { func TestStackConfigurationCreateUploadAndRead(t *testing.T) { t.Parallel() - skipUnlessBeta(t) client := testClient(t) ctx := context.Background() @@ -127,7 +125,6 @@ func TestStackConfigurationCreateUploadAndRead(t *testing.T) { func TestStackConfigurationDiagnostics(t *testing.T) { t.Parallel() - skipUnlessBeta(t) client := testClient(t) ctx := context.Background() @@ -144,9 +141,9 @@ func TestStackConfigurationDiagnostics(t *testing.T) { Name: "test-stack", VCSRepo: &StackVCSRepoOptions{ - Identifier: "ctrombley/linked-stacks-demo-network", + Identifier: stackVCSRepoIdentifier(t), OAuthTokenID: oauthClient.OAuthTokens[0].ID, - Branch: "diagnostics", // This branch will produce diagnostics + Branch: stackVCSRepoBranch(t), }, }) require.NoError(t, err) @@ -174,13 +171,10 @@ func TestStackConfigurationDiagnostics(t *testing.T) { assert.NotEmpty(t, diag.Summary) assert.NotEmpty(t, diag.Detail) assert.NotEmpty(t, diag.Diags) - assert.False(t, diag.Acknowledged) - assert.Nil(t, diag.AcknowledgedAt) assert.NotZero(t, diag.CreatedAt) assert.Nil(t, diag.StackDeploymentStep) assert.NotNil(t, diag.StackConfiguration) - assert.Nil(t, diag.AcknowledgedBy) }) t.Run("Diagnostics with invalid ID", func(t *testing.T) { diff --git a/stack_configuration_summary_integration_test.go b/stack_configuration_summary_integration_test.go index 40301fd8c..a72491561 100644 --- a/stack_configuration_summary_integration_test.go +++ b/stack_configuration_summary_integration_test.go @@ -14,7 +14,6 @@ import ( func TestStackConfigurationSummaryList(t *testing.T) { t.Parallel() - skipUnlessBeta(t) client := testClient(t) ctx := context.Background() @@ -28,7 +27,7 @@ func TestStackConfigurationSummaryList(t *testing.T) { stack, err := client.Stacks.Create(ctx, StackCreateOptions{ Name: "aa-test-stack", VCSRepo: &StackVCSRepoOptions{ - Identifier: "hashicorp-guides/pet-nulls-stack", + Identifier: stackVCSRepoIdentifier(t), OAuthTokenID: oauthClient.OAuthTokens[0].ID, }, Project: &Project{ @@ -40,7 +39,7 @@ func TestStackConfigurationSummaryList(t *testing.T) { stack2, err := client.Stacks.Create(ctx, StackCreateOptions{ Name: "bb-test-stack", VCSRepo: &StackVCSRepoOptions{ - Identifier: "hashicorp-guides/pet-nulls-stack", + Identifier: stackVCSRepoIdentifier(t), OAuthTokenID: oauthClient.OAuthTokens[0].ID, }, Project: &Project{ diff --git a/stack_test_helpers_test.go b/stack_test_helpers_test.go new file mode 100644 index 000000000..521686d7a --- /dev/null +++ b/stack_test_helpers_test.go @@ -0,0 +1,29 @@ +// Copyright IBM Corp. 2018, 2025 +// SPDX-License-Identifier: MPL-2.0 + +package tfe + +import ( + "os" + "testing" +) + +func stackVCSRepoIdentifier(t *testing.T) string { + t.Helper() + + githubIdentifier := os.Getenv("GITHUB_STACK_IDENTIFIER") + if githubIdentifier == "" { + t.Skip("Export a valid GITHUB_STACK_IDENTIFIER before running this test") + } + + return githubIdentifier +} + +func stackVCSRepoBranch(t *testing.T) string { + githubBranch := os.Getenv("GITHUB_STACK_REPO_BRANCH") + if githubBranch == "" { + return "main" + } + + return githubBranch +}