Skip to content

Commit

Permalink
update more tests to use ProviderFactories
Browse files Browse the repository at this point in the history
  • Loading branch information
fairclothjm committed Oct 6, 2023
1 parent 982678f commit ff1a337
Show file tree
Hide file tree
Showing 18 changed files with 66 additions and 66 deletions.
8 changes: 4 additions & 4 deletions vault/data_identity_group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ func TestDataSourceIdentityGroupName(t *testing.T) {
group := acctest.RandomWithPrefix("test-group")

resource.Test(t, resource.TestCase{
Providers: testProviders,
PreCheck: func() { testutil.TestAccPreCheck(t) },
ProviderFactories: providerFactories,
PreCheck: func() { testutil.TestAccPreCheck(t) },
Steps: []resource.TestStep{
{
Config: testDataSourceIdentityGroup_configName(group),
Expand All @@ -41,8 +41,8 @@ func TestDataSourceIdentityGroupAlias(t *testing.T) {
group := acctest.RandomWithPrefix("test-group")

resource.Test(t, resource.TestCase{
Providers: testProviders,
PreCheck: func() { testutil.TestAccPreCheck(t) },
ProviderFactories: providerFactories,
PreCheck: func() { testutil.TestAccPreCheck(t) },
Steps: []resource.TestStep{
{
Config: testDataSourceIdentityGroup_configAlias(group),
Expand Down
4 changes: 2 additions & 2 deletions vault/data_identity_oidc_public_keys_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ func TestDataSourceIdentityOIDCPublicKeys(t *testing.T) {
providerName := acctest.RandomWithPrefix("test-provider")

resource.Test(t, resource.TestCase{
Providers: testProviders,
PreCheck: func() { testutil.TestAccPreCheck(t) },
ProviderFactories: providerFactories,
PreCheck: func() { testutil.TestAccPreCheck(t) },
Steps: []resource.TestStep{
{
Config: testDataSourceIdentityOIDCPublicKeys_config(keyName, clientName, providerName),
Expand Down
8 changes: 4 additions & 4 deletions vault/data_source_generic_secret_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import (

func TestDataSourceGenericSecret(t *testing.T) {
resource.Test(t, resource.TestCase{
Providers: testProviders,
PreCheck: func() { testutil.TestAccPreCheck(t) },
ProviderFactories: providerFactories,
PreCheck: func() { testutil.TestAccPreCheck(t) },
Steps: []resource.TestStep{
{
Config: testDataSourceGenericSecret_config,
Expand All @@ -32,8 +32,8 @@ func TestDataSourceGenericSecret_v2(t *testing.T) {
mount := acctest.RandomWithPrefix("tf-acctest-kv/")
path := acctest.RandomWithPrefix("foo")
resource.Test(t, resource.TestCase{
Providers: testProviders,
PreCheck: func() { testutil.TestAccPreCheck(t) },
ProviderFactories: providerFactories,
PreCheck: func() { testutil.TestAccPreCheck(t) },
Steps: []resource.TestStep{
{
Config: testDataSourceV2Secret_config(mount, path),
Expand Down
2 changes: 1 addition & 1 deletion vault/data_source_kubernetes_credentials_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func TestAccKubernetesSecretCredentialsDataSource(t *testing.T) {
name := acctest.RandomWithPrefix("tf-test-role")

resource.Test(t, resource.TestCase{
Providers: testProviders,
ProviderFactories: providerFactories,
PreCheck: func() {
testutil.TestAccPreCheck(t)
},
Expand Down
4 changes: 2 additions & 2 deletions vault/data_source_kv_secret_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ func TestDataSourceKVSecret(t *testing.T) {

resourceName := "data.vault_kv_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: testDataSourceKVSecretConfig(mount, name),
Expand Down
8 changes: 4 additions & 4 deletions vault/data_source_nomad_credentials_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ func TestAccDataSourceNomadAccessCredentialsClientBasic(t *testing.T) {
address, token := testutil.GetTestNomadCreds(t)

resource.Test(t, resource.TestCase{
Providers: testProviders,
PreCheck: func() { testutil.TestAccPreCheck(t) },
ProviderFactories: providerFactories,
PreCheck: func() { testutil.TestAccPreCheck(t) },
Steps: []resource.TestStep{
{
Config: testAccDataSourceNomadAccessCredentialsConfig(backend, address, token, "test"),
Expand All @@ -37,8 +37,8 @@ func TestAccDataSourceNomadAccessCredentialsManagementBasic(t *testing.T) {
address, token := testutil.GetTestNomadCreds(t)

resource.Test(t, resource.TestCase{
Providers: testProviders,
PreCheck: func() { testutil.TestAccPreCheck(t) },
ProviderFactories: providerFactories,
PreCheck: func() { testutil.TestAccPreCheck(t) },
Steps: []resource.TestStep{
{
Config: testAccDataSourceNomadAccessCredentialsManagementConfig(backend, address, token, "test"),
Expand Down
4 changes: 2 additions & 2 deletions vault/data_source_transit_encrypt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import (

func TestDataSourceTransitEncrypt(t *testing.T) {
resource.Test(t, resource.TestCase{
Providers: testProviders,
PreCheck: func() { testutil.TestAccPreCheck(t) },
ProviderFactories: providerFactories,
PreCheck: func() { testutil.TestAccPreCheck(t) },
Steps: []resource.TestStep{
{
Config: testDataSourceTransitEncrypt_config,
Expand Down
12 changes: 6 additions & 6 deletions vault/resource_aws_auth_backend_login_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ func TestAccAWSAuthBackendLogin_iamIdentity(t *testing.T) {
reqHeaders := base64.StdEncoding.EncodeToString(loginDataHeaders)
reqBody := base64.StdEncoding.EncodeToString(loginDataBody)
resource.Test(t, resource.TestCase{
Providers: testProviders,
PreCheck: func() { testutil.TestAccPreCheck(t) },
ProviderFactories: providerFactories,
PreCheck: func() { testutil.TestAccPreCheck(t) },
Steps: []resource.TestStep{
{
Config: testAccDataSourceAWSAuthBackendLoginConfig_iamIdentity(mountPath, accessKey, secretKey, reqMethod, reqURL, reqHeaders, reqBody, roleName, *testIdentity.Arn),
Expand Down Expand Up @@ -99,8 +99,8 @@ func TestAccAWSAuthBackendLogin_pkcs7(t *testing.T) {
pkcs7 = strings.Replace(pkcs7, "\n", "", -1)

resource.Test(t, resource.TestCase{
Providers: testProviders,
PreCheck: func() { testutil.TestAccPreCheck(t) },
ProviderFactories: providerFactories,
PreCheck: func() { testutil.TestAccPreCheck(t) },
Steps: []resource.TestStep{
{
Config: testAccDataSourceAWSAuthBackendLoginConfig_pkcs7(mountPath, accessKey, secretKey, roleName, ami, account, arn, pkcs7),
Expand Down Expand Up @@ -155,8 +155,8 @@ func TestAccAWSAuthBackendLogin_ec2Identity(t *testing.T) {
sig = strings.Replace(sig, "\n", "", -1)

resource.Test(t, resource.TestCase{
Providers: testProviders,
PreCheck: func() { testutil.TestAccPreCheck(t) },
ProviderFactories: providerFactories,
PreCheck: func() { testutil.TestAccPreCheck(t) },
Steps: []resource.TestStep{
{
Config: testAccDataSourceAWSAuthBackendLoginConfig_ec2Identity(mountPath, accessKey, secretKey, roleName, ami, account, arn, identity, sig),
Expand Down
4 changes: 2 additions & 2 deletions vault/resource_azure_secret_backend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func TestAzureSecretBackend(t *testing.T) {
resourceName := resourceType + ".test"

resource.Test(t, resource.TestCase{
Providers: testProviders,
ProviderFactories: providerFactories,
PreCheck: func() {
testutil.TestAccPreCheck(t)
},
Expand Down Expand Up @@ -129,7 +129,7 @@ func TestAzureSecretBackend_remount(t *testing.T) {
}

resource.Test(t, resource.TestCase{
Providers: testProviders,
ProviderFactories: providerFactories,
PreCheck: func() {
testutil.TestAccPreCheck(t)
},
Expand Down
4 changes: 2 additions & 2 deletions vault/resource_database_secret_backend_connection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1139,8 +1139,8 @@ resource "vault_database_secret_backend_connection" "test" {
}
}`, name, name, pluginName)
resource.Test(t, resource.TestCase{
Providers: testProviders,
PreCheck: func() { testutil.TestAccPreCheck(t) },
ProviderFactories: providerFactories,
PreCheck: func() { testutil.TestAccPreCheck(t) },
Steps: []resource.TestStep{
{
Config: config,
Expand Down
4 changes: 2 additions & 2 deletions vault/resource_github_team_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ func TestAccGithubTeam_importBasic(t *testing.T) {
resName := "vault_github_team.team"
team := "import-team"
resource.Test(t, resource.TestCase{
PreCheck: func() { testutil.TestAccPreCheck(t) },
Providers: testProviders,
PreCheck: func() { testutil.TestAccPreCheck(t) },
ProviderFactories: providerFactories,
Steps: []resource.TestStep{
{
Config: testAccGithubTeamConfig_basic(backend, team, []string{"admin", "developer"}),
Expand Down
16 changes: 8 additions & 8 deletions vault/resource_jwt_auth_backend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,8 @@ func TestAccJWTAuthBackend_invalid(t *testing.T) {
path := acctest.RandomWithPrefix("jwt")
invalidPath := path + consts.PathDelim
resource.Test(t, resource.TestCase{
PreCheck: func() { testutil.TestAccPreCheck(t) },
Providers: testProviders,
PreCheck: func() { testutil.TestAccPreCheck(t) },
ProviderFactories: providerFactories,
Steps: []resource.TestStep{
{
Config: testAccJWTAuthBackendConfig(invalidPath, "", false),
Expand Down Expand Up @@ -263,8 +263,8 @@ func TestJWTAuthBackend_remount(t *testing.T) {
resourceName := "vault_jwt_auth_backend.jwt"

resource.Test(t, resource.TestCase{
Providers: testProviders,
PreCheck: func() { testutil.TestAccPreCheck(t) },
ProviderFactories: providerFactories,
PreCheck: func() { testutil.TestAccPreCheck(t) },
Steps: []resource.TestStep{
{
Config: testAccJWTAuthBackendConfig(path, "", false),
Expand Down Expand Up @@ -415,8 +415,8 @@ func TestAccJWTAuthBackend_missingMandatory(t *testing.T) {
t.Parallel()
path := acctest.RandomWithPrefix("jwt")
resource.Test(t, resource.TestCase{
PreCheck: func() { testutil.TestAccPreCheck(t) },
Providers: testProviders,
PreCheck: func() { testutil.TestAccPreCheck(t) },
ProviderFactories: providerFactories,
Steps: []resource.TestStep{
{
Config: fmt.Sprintf(`resource "vault_jwt_auth_backend" "bad" {
Expand Down Expand Up @@ -549,8 +549,8 @@ func TestAccJWTAuthBackendProviderConfigConversionInt(t *testing.T) {
func TestAccJWTAuthBackendProviderConfig_negative(t *testing.T) {
t.Skip(true)
resource.Test(t, resource.TestCase{
PreCheck: func() { testutil.TestAccPreCheck(t) },
Providers: testProviders,
PreCheck: func() { testutil.TestAccPreCheck(t) },
ProviderFactories: providerFactories,
Steps: []resource.TestStep{
{
Config: fmt.Sprintf(`resource "vault_jwt_auth_backend" "oidc" {
Expand Down
4 changes: 2 additions & 2 deletions vault/resource_mfa_okta_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ func TestMFAOktaBasic(t *testing.T) {
resourceName := "vault_mfa_okta.test"

resource.Test(t, resource.TestCase{
PreCheck: func() { testutil.TestEntPreCheck(t) },
Providers: testProviders,
PreCheck: func() { testutil.TestEntPreCheck(t) },
ProviderFactories: providerFactories,
Steps: []resource.TestStep{
{
Config: testMFAOktaConfig(path),
Expand Down
4 changes: 2 additions & 2 deletions vault/resource_mfa_pingid_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ func TestMFAPingIDBasic(t *testing.T) {
resourceName := "vault_mfa_pingid.test"

resource.Test(t, resource.TestCase{
PreCheck: func() { testutil.TestEntPreCheck(t) },
Providers: testProviders,
PreCheck: func() { testutil.TestEntPreCheck(t) },
ProviderFactories: providerFactories,
Steps: []resource.TestStep{
{
Config: testMFAPingIDConfig(path, settingsFile),
Expand Down
32 changes: 16 additions & 16 deletions vault/resource_mount_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ type testMountConfig struct {
func TestZeroTTLDoesNotCauseUpdate(t *testing.T) {
path := acctest.RandomWithPrefix("example")
resource.Test(t, resource.TestCase{
Providers: testProviders,
PreCheck: func() { testutil.TestAccPreCheck(t) },
ProviderFactories: providerFactories,
PreCheck: func() { testutil.TestAccPreCheck(t) },
Steps: []resource.TestStep{
{
Config: fmt.Sprintf(`
Expand Down Expand Up @@ -69,8 +69,8 @@ func TestResourceMount(t *testing.T) {
description: "updated",
}
resource.Test(t, resource.TestCase{
Providers: testProviders,
PreCheck: func() { testutil.TestAccPreCheck(t) },
ProviderFactories: providerFactories,
PreCheck: func() { testutil.TestAccPreCheck(t) },
Steps: []resource.TestStep{
{
Config: testResourceMount_initialConfig(cfg),
Expand All @@ -93,8 +93,8 @@ func TestResourceMount(t *testing.T) {
func TestResourceMount_Local(t *testing.T) {
path := "example-" + acctest.RandString(10)
resource.Test(t, resource.TestCase{
Providers: testProviders,
PreCheck: func() { testutil.TestAccPreCheck(t) },
ProviderFactories: providerFactories,
PreCheck: func() { testutil.TestAccPreCheck(t) },
Steps: []resource.TestStep{
{
Config: testResourceMount_InitialConfigLocalMount(path),
Expand All @@ -113,8 +113,8 @@ func TestResourceMount_Local(t *testing.T) {
func TestResourceMount_SealWrap(t *testing.T) {
path := "example-" + acctest.RandString(10)
resource.Test(t, resource.TestCase{
Providers: testProviders,
PreCheck: func() { testutil.TestAccPreCheck(t) },
ProviderFactories: providerFactories,
PreCheck: func() { testutil.TestAccPreCheck(t) },
Steps: []resource.TestStep{
{
Config: testResourceMount_InitialConfigSealWrap(path),
Expand All @@ -138,8 +138,8 @@ func TestResourceMount_AuditNonHMACRequestKeys(t *testing.T) {
expectReqKeysUpdate := []string{"test3request", "test4request"}
expectRespKeysUpdate := []string{"test3response", "test4response"}
resource.Test(t, resource.TestCase{
Providers: testProviders,
PreCheck: func() { testutil.TestAccPreCheck(t) },
ProviderFactories: providerFactories,
PreCheck: func() { testutil.TestAccPreCheck(t) },
Steps: []resource.TestStep{
{
Config: testResourceMount_AuditNonHMACRequestKeysConfig(path, expectReqKeysNew, expectRespKeysNew),
Expand Down Expand Up @@ -189,8 +189,8 @@ func TestResourceMount_KVV2(t *testing.T) {
description: "Example mount for testing",
}
resource.Test(t, resource.TestCase{
Providers: testProviders,
PreCheck: func() { testutil.TestAccPreCheck(t) },
ProviderFactories: providerFactories,
PreCheck: func() { testutil.TestAccPreCheck(t) },
Steps: []resource.TestStep{
{
Config: kvv2Cfg,
Expand All @@ -209,8 +209,8 @@ func TestResourceMount_KVV2(t *testing.T) {
func TestResourceMount_ExternalEntropyAccess(t *testing.T) {
path := acctest.RandomWithPrefix("example")
resource.Test(t, resource.TestCase{
Providers: testProviders,
PreCheck: func() { testutil.TestAccPreCheck(t) },
ProviderFactories: providerFactories,
PreCheck: func() { testutil.TestAccPreCheck(t) },
Steps: []resource.TestStep{
{
Config: testResourceMount_InitialConfigExternalEntropyAccess(path),
Expand Down Expand Up @@ -243,8 +243,8 @@ func TestResourceMountMangedKeys(t *testing.T) {
resourceName := "vault_mount.test"

resource.Test(t, resource.TestCase{
Providers: testProviders,
PreCheck: func() { testutil.TestAccPreCheck(t) },
ProviderFactories: providerFactories,
PreCheck: func() { testutil.TestAccPreCheck(t) },
Steps: []resource.TestStep{
{
Config: testResourceMount_managedKeysConfig(keyName, path, false),
Expand Down
4 changes: 2 additions & 2 deletions vault/resource_policy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import (
func TestResourcePolicy(t *testing.T) {
name := acctest.RandomWithPrefix("test-")
resource.Test(t, resource.TestCase{
Providers: testProviders,
PreCheck: func() { testutil.TestAccPreCheck(t) },
ProviderFactories: providerFactories,
PreCheck: func() { testutil.TestAccPreCheck(t) },
Steps: []resource.TestStep{
{
Config: testResourcePolicy_initialConfig(name),
Expand Down
4 changes: 2 additions & 2 deletions vault/resource_ssh_secret_backend_ca_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ func TestAccSSHSecretBackendCA_provided(t *testing.T) {
func TestAccSSHSecretBackend_import(t *testing.T) {
backend := "ssh-" + acctest.RandString(10)
resource.Test(t, resource.TestCase{
Providers: testProviders,
PreCheck: func() { testutil.TestAccPreCheck(t) },
ProviderFactories: providerFactories,
PreCheck: func() { testutil.TestAccPreCheck(t) },
Steps: []resource.TestStep{
{
Config: testAccSSHSecretBackendCAConfigGenerated(backend),
Expand Down
6 changes: 3 additions & 3 deletions vault/resource_terraform_cloud_secret_creds_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func TestAccResourceTerraformCloudSecretCredsOrganizationBasic(t *testing.T) {
token, organization := vals[0], vals[1]

resource.Test(t, resource.TestCase{
Providers: testProviders,
ProviderFactories: providerFactories,
PreCheck: func() {
testutil.TestAccPreCheck(t)
},
Expand All @@ -48,7 +48,7 @@ func TestAccResourceTerraformCloudSecretCredsTeamBasic(t *testing.T) {
token, organization, teamID := vals[0], vals[1], vals[2]

resource.Test(t, resource.TestCase{
Providers: testProviders,
ProviderFactories: providerFactories,
PreCheck: func() {
testutil.TestAccPreCheck(t)
},
Expand All @@ -74,7 +74,7 @@ func TestAccResourceTerraformCloudSecretCredsUserBasic(t *testing.T) {
token, userID := vals[0], vals[1]

resource.Test(t, resource.TestCase{
Providers: testProviders,
ProviderFactories: providerFactories,
PreCheck: func() {
testutil.TestAccPreCheck(t)
},
Expand Down

0 comments on commit ff1a337

Please sign in to comment.