Skip to content

Commit

Permalink
Fixes failing tests for make test run in build step (#2110)
Browse files Browse the repository at this point in the history
* fix duplicate features heading in changelog

* add skip test acc to acceptance tests to fix build

* add helper wrapper function for github namespace checks
  • Loading branch information
vinay-gopalan authored Dec 13, 2023
1 parent 2dc27b1 commit 541ce93
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 7 deletions.
4 changes: 1 addition & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@

FEATURES:
* Add support for `ext_key_usage_oids` in `vault_pki_secret_backend_role` ([#2108](/~https://github.com/hashicorp/terraform-provider-vault/pull/2108))
* Adds support to `vault_gcp_auth_backend` for common backend tune parameters ([#1997](/~https://github.com/terraform-providers/terraform-provider-vault/pull/1997)).

BUGS:
* fix `vault_kv_secret_v2` drift when "data" is in secret name/path ([#2104](/~https://github.com/hashicorp/terraform-provider-vault/pull/2104))

FEATURES:
* Adds support to `vault_gcp_auth_backend` for common backend tune parameters ([#1997](/~https://github.com/terraform-providers/terraform-provider-vault/pull/1997)).

## 3.23.0 (Nov 15, 2023)

FEATURES:
Expand Down
2 changes: 2 additions & 0 deletions vault/resource_auth_backend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ func testResourceAuth_initialCheck(expectedPath string) resource.TestCheckFunc {
}

func TestResourceAuthTune(t *testing.T) {
testutil.SkipTestAcc(t)

backend := acctest.RandomWithPrefix("github")
resName := "vault_auth_backend.test"
var resAuthFirst api.AuthMount
Expand Down
2 changes: 1 addition & 1 deletion vault/resource_gcp_auth_backend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const gcpJSONCredentials string = `
`

func TestGCPAuthBackend_basic(t *testing.T) {
testutil.SkipTestEnvSet(t, testutil.EnvVarSkipVaultNext)
testutil.SkipTestAcc(t)

var resAuthFirst api.AuthMount
path := resource.PrefixedUniqueId("gcp-basic-")
Expand Down
29 changes: 26 additions & 3 deletions vault/resource_github_auth_backend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
"github.com/hashicorp/vault/api"

"github.com/hashicorp/terraform-provider-vault/internal/consts"
Expand Down Expand Up @@ -90,9 +91,7 @@ func TestAccGithubAuthBackend_ns(t *testing.T) {
{
Config: testAccGithubAuthBackendConfig_ns(ns, path, testGHOrg),
Check: resource.ComposeTestCheckFunc(
testutil.TestAccCheckAuthMountExists(resourceName,
&resAuth,
testProvider.Meta().(*provider.ProviderMeta).MustGetClient()),
githubAuthMountExistsHelperNS(resourceName, &resAuth),
resource.TestCheckResourceAttr(resourceName, "id", path),
resource.TestCheckResourceAttr(resourceName, consts.FieldPath, path),
resource.TestCheckResourceAttr(resourceName, "organization", testGHOrg),
Expand All @@ -107,6 +106,26 @@ func TestAccGithubAuthBackend_ns(t *testing.T) {
})
}

func githubAuthMountExistsHelperNS(resourceName string, out *api.AuthMount) resource.TestCheckFunc {
return func(s *terraform.State) error {
rs, ok := s.RootModule().Resources[resourceName]
if !ok {
return fmt.Errorf("Not found: %s", resourceName)
}

if rs.Primary.ID == "" {
return fmt.Errorf("No id for %s is set", resourceName)
}

client, e := provider.GetClient(rs.Primary, testProvider.Meta())
if e != nil {
return e
}

return testutil.AuthMountExistsHelper(resourceName, s, out, client)
}
}

func TestAccGithubAuthBackend_tuning(t *testing.T) {
testutil.SkipTestAcc(t)

Expand Down Expand Up @@ -224,6 +243,8 @@ func TestAccGithubAuthBackend_description(t *testing.T) {
}

func TestAccGithubAuthBackend_importTuning(t *testing.T) {
testutil.SkipTestAcc(t)

path := acctest.RandomWithPrefix("github")
resourceType := "vault_github_auth_backend"
resourceName := resourceType + ".test"
Expand All @@ -245,6 +266,8 @@ func TestAccGithubAuthBackend_importTuning(t *testing.T) {
}

func TestGithubAuthBackend_remount(t *testing.T) {
testutil.SkipTestAcc(t)

path := acctest.RandomWithPrefix("tf-test-gh")
updatedPath := acctest.RandomWithPrefix("tf-test-gh-updated")

Expand Down

0 comments on commit 541ce93

Please sign in to comment.