Skip to content

Commit 113d9f2

Browse files
authored
Merge pull request #44393 from hashicorp/b-generate-existing-resource-norefresh-nochange-test-after-v6
Generates `Identity_ExistingResource_NoRefresh_NoChange` for resource types added after v6.0
2 parents 21d8377 + fc9ea11 commit 113d9f2

File tree

100 files changed

+5647
-60
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+5647
-60
lines changed

internal/generate/identitytests/resource_test.go.gtpl

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -998,6 +998,67 @@ func {{ template "testname" . }}_Identity_RegionOverride(t *testing.T) {
998998
},
999999
})
10001000
}
1001+
1002+
// Resource Identity was added after v{{ .PreIdentityVersion }}
1003+
func {{ template "testname" . }}_Identity_ExistingResource_NoRefresh_NoChange(t *testing.T) {
1004+
{{- template "Init" . }}
1005+
1006+
{{ template "Test" . }}(ctx, t, resource.TestCase{
1007+
{{ template "TestCaseSetupNoProviders" . }}
1008+
AdditionalCLIOptions: &resource.AdditionalCLIOptions{
1009+
Plan: resource.PlanOptions{
1010+
NoRefresh: true,
1011+
},
1012+
},
1013+
Steps: []resource.TestStep{
1014+
{{ $step := 1 -}}
1015+
// Step {{ $step }}: Create pre-Identity
1016+
{
1017+
{{ if .UseAlternateAccount -}}
1018+
ProtoV5ProviderFactories: acctest.ProtoV5FactoriesNamed(ctx, t, providers, acctest.ProviderNameAlternate),
1019+
{{ end -}}
1020+
ConfigDirectory: config.StaticDirectory("testdata/{{ .Name }}/basic_v{{ .PreIdentityVersion }}/"),
1021+
ConfigVariables: config.Variables{ {{ if .Generator }}
1022+
acctest.CtRName: config.StringVariable(rName),{{ end }}
1023+
{{ template "AdditionalTfVars" . }}
1024+
},
1025+
{{ if .HasExistsFunc -}}
1026+
Check: resource.ComposeAggregateTestCheckFunc(
1027+
{{- template "ExistsCheck" . -}}
1028+
),
1029+
{{ end -}}
1030+
ConfigStateChecks: []statecheck.StateCheck{
1031+
tfstatecheck.ExpectNoIdentity(resourceName),
1032+
},
1033+
},
1034+
1035+
// Step {{ ($step = inc $step) | print }}: Current version
1036+
{
1037+
{{ if .UseAlternateAccount -}}
1038+
ProtoV5ProviderFactories: acctest.ProtoV5FactoriesNamedAlternate(ctx, t, providers),
1039+
{{ else -}}
1040+
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories,
1041+
{{ end -}}
1042+
ConfigDirectory: config.StaticDirectory("testdata/{{ .Name }}/basic/"),
1043+
ConfigVariables: config.Variables{ {{ if .Generator }}
1044+
acctest.CtRName: config.StringVariable(rName),{{ end }}
1045+
{{ template "AdditionalTfVars" . }}
1046+
},
1047+
ConfigPlanChecks: resource.ConfigPlanChecks{
1048+
PreApply: []plancheck.PlanCheck{
1049+
plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop),
1050+
},
1051+
PostApplyPostRefresh: []plancheck.PlanCheck{
1052+
plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop),
1053+
},
1054+
},
1055+
ConfigStateChecks: []statecheck.StateCheck{
1056+
tfstatecheck.ExpectNoIdentity(resourceName),
1057+
},
1058+
},
1059+
},
1060+
})
1061+
}
10011062
{{ else }}
10021063
func {{ template "testname" . }}_Identity_ExistingResource(t *testing.T) {
10031064
{{- template "Init" . }}

internal/service/batch/job_definition_identity_gen_test.go

Lines changed: 58 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/service/cloudfrontkeyvaluestore/key_identity_gen_test.go

Lines changed: 57 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/service/cloudwatch/metric_alarm_identity_gen_test.go

Lines changed: 58 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/service/cognitoidp/log_delivery_configuration.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import (
3434
// @Testing(existsType="github.com/aws/aws-sdk-go-v2/service/cognitoidentityprovider/types;awstypes;awstypes.LogDeliveryConfigurationType")
3535
// @Testing(importStateIdFunc="testAccLogDeliveryConfigurationImportStateIdFunc")
3636
// @Testing(importStateIdAttribute="user_pool_id")
37-
// @Testing(preIdentityVersion="v6.3.0")
37+
// @Testing(hasNoPreExistingResource=true)
3838
func newLogDeliveryConfigurationResource(context.Context) (resource.ResourceWithConfigure, error) {
3939
r := &logDeliveryConfigurationResource{}
4040
return r, nil

internal/service/cognitoidp/log_delivery_configuration_identity_gen_test.go

Lines changed: 0 additions & 59 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/service/ec2/ec2_instance_identity_gen_test.go

Lines changed: 53 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)