Skip to content

Commit

Permalink
use ProviderFactories in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fairclothjm committed Oct 5, 2023
1 parent 7cbb81c commit 982678f
Show file tree
Hide file tree
Showing 13 changed files with 32 additions and 35 deletions.
8 changes: 4 additions & 4 deletions vault/data_identity_entity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ func TestDataSourceIdentityEntityName(t *testing.T) {

resourceName := "data.vault_identity_entity.entity"
resource.Test(t, resource.TestCase{
Providers: testProviders,
PreCheck: func() { testutil.TestAccPreCheck(t) },
ProviderFactories: providerFactories,
PreCheck: func() { testutil.TestAccPreCheck(t) },
Steps: []resource.TestStep{
{
Config: testDataSourceIdentityEntity_configName(entity),
Expand All @@ -44,8 +44,8 @@ func TestDataSourceIdentityEntityAlias(t *testing.T) {

resourceName := "data.vault_identity_entity.entity"
resource.Test(t, resource.TestCase{
Providers: testProviders,
PreCheck: func() { testutil.TestAccPreCheck(t) },
ProviderFactories: providerFactories,
PreCheck: func() { testutil.TestAccPreCheck(t) },
Steps: []resource.TestStep{
{
Config: testDataSourceIdentityEntity_configAlias(entity),
Expand Down
4 changes: 2 additions & 2 deletions vault/data_identity_oidc_client_creds_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ func TestDataSourceIdentityOIDCClientCreds(t *testing.T) {
name := acctest.RandomWithPrefix("test-client")

resource.Test(t, resource.TestCase{
Providers: testProviders,
PreCheck: func() { testutil.TestAccPreCheck(t) },
ProviderFactories: providerFactories,
PreCheck: func() { testutil.TestAccPreCheck(t) },
Steps: []resource.TestStep{
{
Config: testDataSourceIdentityOIDCClientCreds_config(name),
Expand Down
4 changes: 2 additions & 2 deletions vault/data_source_gcp_auth_backend_role_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ func TestAccGCPAuthBackendRoleDataSource_none(t *testing.T) {
name := acctest.RandomWithPrefix("tf-test-gcp-role")

resource.Test(t, resource.TestCase{
PreCheck: func() { testutil.TestAccPreCheck(t) },
Providers: testProviders,
PreCheck: func() { testutil.TestAccPreCheck(t) },
ProviderFactories: providerFactories,
Steps: []resource.TestStep{
{
Config: testAccGCPAuthBackendRoleDataSourceConfig(backend, name),
Expand Down
4 changes: 2 additions & 2 deletions vault/data_source_kv_subkeys_v2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ func TestDataSourceKVSubkeys(t *testing.T) {
expectedSubkeys := `{"baz":{"riff":null},"foo":null,"zip":null}`

resource.Test(t, resource.TestCase{
Providers: testProviders,
PreCheck: func() { testutil.TestAccPreCheck(t) },
ProviderFactories: providerFactories,
PreCheck: func() { testutil.TestAccPreCheck(t) },
Steps: []resource.TestStep{
{
Config: testDataSourceKVSubkeysConfig(mount, secretPath),
Expand Down
4 changes: 2 additions & 2 deletions vault/import_mount_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ func TestAccMount_importBasic(t *testing.T) {
version: "1",
}
resource.Test(t, resource.TestCase{
PreCheck: func() { testutil.TestAccPreCheck(t) },
Providers: testProviders,
PreCheck: func() { testutil.TestAccPreCheck(t) },
ProviderFactories: providerFactories,
Steps: []resource.TestStep{
{
Config: testResourceMount_initialConfig(cfg),
Expand Down
4 changes: 2 additions & 2 deletions vault/resource_approle_auth_backend_login_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ func TestAccAppRoleAuthBackendLogin_basic(t *testing.T) {
role := acctest.RandomWithPrefix("test-role")

resource.Test(t, resource.TestCase{
PreCheck: func() { testutil.TestAccPreCheck(t) },
Providers: testProviders,
PreCheck: func() { testutil.TestAccPreCheck(t) },
ProviderFactories: providerFactories,
Steps: []resource.TestStep{
{
Config: testAccAppRoleAuthBackendLoginConfig_basic(backend, role),
Expand Down
8 changes: 4 additions & 4 deletions vault/resource_approle_auth_backend_role_secret_id_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ func TestAccAppRoleAuthBackendRoleSecretID_wrapped_namespace(t *testing.T) {

namespacePath := acctest.RandomWithPrefix("test-namespace")
resource.Test(t, resource.TestCase{
PreCheck: func() { testutil.TestEntPreCheck(t) },
Providers: testProviders,
PreCheck: func() { testutil.TestEntPreCheck(t) },
ProviderFactories: providerFactories,
CheckDestroy: func(s *terraform.State) error {
if err := testAccCheckAppRoleAuthBackendRoleSecretIDDestroy(s); err != nil {
return err
Expand Down Expand Up @@ -130,8 +130,8 @@ func TestAccAppRoleAuthBackendRoleSecretID_wrapped_namespace_withWrappedAccessor

namespacePath := acctest.RandomWithPrefix("test-namespace")
resource.Test(t, resource.TestCase{
PreCheck: func() { testutil.TestEntPreCheck(t) },
Providers: testProviders,
PreCheck: func() { testutil.TestEntPreCheck(t) },
ProviderFactories: providerFactories,
CheckDestroy: func(s *terraform.State) error {
if err := testAccCheckAppRoleAuthBackendRoleSecretIDDestroy(s); err != nil {
return err
Expand Down
4 changes: 2 additions & 2 deletions vault/resource_aws_auth_backend_role_tag_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ func TestAccAWSAuthBackendRoleTag_basic(t *testing.T) {
backend := acctest.RandomWithPrefix("tf-test-aws")
role := acctest.RandomWithPrefix("tf-test-aws")
resource.Test(t, resource.TestCase{
Providers: testProviders,
PreCheck: func() { testutil.TestAccPreCheck(t) },
ProviderFactories: providerFactories,
PreCheck: func() { testutil.TestAccPreCheck(t) },
Steps: []resource.TestStep{
{
Config: testAccAWSAuthBackendRoleTagConfig_basic(backend, role),
Expand Down
12 changes: 6 additions & 6 deletions vault/resource_generic_secret_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ func TestResourceGenericSecret(t *testing.T) {
path := fmt.Sprintf("%s/%s", mount, name)
resourceName := "vault_generic_secret.test"
resource.Test(t, resource.TestCase{
Providers: testProviders,
PreCheck: func() { testutil.TestAccPreCheck(t) },
ProviderFactories: providerFactories,
PreCheck: func() { testutil.TestAccPreCheck(t) },
Steps: []resource.TestStep{
{
Config: testResourceGenericSecret_initialConfig(mount, name),
Expand All @@ -51,8 +51,8 @@ func TestResourceGenericSecretNS(t *testing.T) {
resourceName := "vault_generic_secret.test"

resource.Test(t, resource.TestCase{
Providers: testProviders,
PreCheck: func() { testutil.TestEntPreCheck(t) },
ProviderFactories: providerFactories,
PreCheck: func() { testutil.TestEntPreCheck(t) },
Steps: []resource.TestStep{
{
Config: testResourceGenericSecret_initialConfigNS(ns, mount, name),
Expand Down Expand Up @@ -100,8 +100,8 @@ func TestResourceGenericSecret_deleted(t *testing.T) {
name := acctest.RandomWithPrefix("test")
path := fmt.Sprintf("%s/%s", mount, name)
resource.Test(t, resource.TestCase{
Providers: testProviders,
PreCheck: func() { testutil.TestAccPreCheck(t) },
ProviderFactories: providerFactories,
PreCheck: func() { testutil.TestAccPreCheck(t) },
Steps: []resource.TestStep{
{
Config: testResourceGenericSecret_initialConfig(mount, name),
Expand Down
2 changes: 1 addition & 1 deletion vault/resource_quota_rate_limit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func TestQuotaRateLimitWithRole(t *testing.T) {
resourceName := "vault_quota_rate_limit.foobar"

resource.Test(t, resource.TestCase{
Providers: testProviders,
ProviderFactories: providerFactories,
PreCheck: func() {
testutil.TestAccPreCheck(t)
SkipIfAPIVersionLT(t, testProvider.Meta(), provider.VaultVersion112)
Expand Down
2 changes: 1 addition & 1 deletion vault/resource_raft_snapshot_agent_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
func TestAccRaftSnapshotAgentConfig_basic(t *testing.T) {
name := acctest.RandomWithPrefix("tf-test-raft-snapshot")
resource.Test(t, resource.TestCase{
Providers: testProviders,
ProviderFactories: providerFactories,
PreCheck: func() {
testutil.SkipTestEnvSet(t, "SKIP_RAFT_TESTS")
testutil.TestEntPreCheck(t)
Expand Down
9 changes: 3 additions & 6 deletions vault/resource_ssh_secret_backend_role_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,29 +147,26 @@ func TestAccSSHSecretBackendRole(t *testing.T) {

t.Run("vault-1.11-and-below", func(t *testing.T) {
resource.Test(t, resource.TestCase{
Providers: testProviders,
ProviderFactories: providerFactories,
PreCheck: func() {
testutil.TestAccPreCheck(t)
SkipIfAPIVersionGTE(t, testProvider.Meta(), provider.VaultVersion112)

},
CheckDestroy: testAccSSHSecretBackendRoleCheckDestroy,
Steps: getSteps(""),
})
})
t.Run("vault-1.12-and-up", func(t *testing.T) {
resource.Test(t, resource.TestCase{
Providers: testProviders,
ProviderFactories: providerFactories,
PreCheck: func() {
testutil.TestAccPreCheck(t)
SkipIfAPIVersionLT(t, testProvider.Meta(), provider.VaultVersion112)

},
CheckDestroy: testAccSSHSecretBackendRoleCheckDestroy,
Steps: getSteps("allowed_domains_template = true"),
})
})

}

func TestAccSSHSecretBackendRoleOTP_basic(t *testing.T) {
Expand Down Expand Up @@ -200,7 +197,7 @@ func TestAccSSHSecretBackendRole_template(t *testing.T) {
resourceName := "vault_ssh_secret_backend_role.test_role"

resource.Test(t, resource.TestCase{
Providers: testProviders,
ProviderFactories: providerFactories,
PreCheck: func() {
testutil.TestAccPreCheck(t)
SkipIfAPIVersionLT(t, testProvider.Meta(), provider.VaultVersion112)
Expand Down
2 changes: 1 addition & 1 deletion vault/resource_terraform_cloud_secret_role_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func TestTerraformCloudSecretRole(t *testing.T) {
vals := testutil.SkipTestEnvUnset(t, "TEST_TF_TOKEN", "TEST_TF_TEAM_ID", "TEST_TF_USER_ID")
token, teamID, userID := vals[0], vals[1], vals[2]
resource.Test(t, resource.TestCase{
Providers: testProviders,
ProviderFactories: providerFactories,
PreCheck: func() {
testutil.TestAccPreCheck(t)
},
Expand Down

0 comments on commit 982678f

Please sign in to comment.