Skip to content

Commit

Permalink
Add PreCheck and remove SkipFunc to fix Vault 1.11 acceptance testing.
Browse files Browse the repository at this point in the history
  • Loading branch information
roberteckert committed Oct 3, 2023
1 parent 6ad1391 commit f43291a
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions vault/resource_transit_secret_backend_key_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,16 +158,15 @@ func TestTransitSecretBackendKey_hmac(t *testing.T) {
name := acctest.RandomWithPrefix("key")
resourceName := "vault_transit_secret_backend_key.test"
resource.Test(t, resource.TestCase{
Providers: testProviders,
PreCheck: func() { testutil.TestAccPreCheck(t) },
Providers: testProviders,
PreCheck: func() {
testutil.TestAccPreCheck(t)
SkipIfAPIVersionLT(t, testProvider.Meta(), provider.VaultVersion112)
},
CheckDestroy: testTransitSecretBackendKeyCheckDestroy,
Steps: []resource.TestStep{
{
Config: testTransitSecretBackendKeyConfig_hmac(name, backend),
SkipFunc: func() (bool, error) {
meta := testProvider.Meta().(*provider.ProviderMeta)
return !meta.IsAPISupported(provider.VaultVersion112), nil
},
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr(resourceName, "backend", backend),
resource.TestCheckResourceAttr(resourceName, "name", name),
Expand All @@ -187,10 +186,6 @@ func TestTransitSecretBackendKey_hmac(t *testing.T) {
},
{
Config: testTransitSecretBackendKeyConfig_hmacupdated(name, backend),
SkipFunc: func() (bool, error) {
meta := testProvider.Meta().(*provider.ProviderMeta)
return !meta.IsAPISupported(provider.VaultVersion112), nil
},
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr(resourceName, "backend", backend),
resource.TestCheckResourceAttr(resourceName, "name", name),
Expand Down

0 comments on commit f43291a

Please sign in to comment.