Skip to content

Commit 5642185

Browse files
authored
Merge pull request #47989 from hashicorp/td-disappears-d
Use `ExpectResourceAction` with `_disappears` tests (`d*`-`e*` services)
2 parents 5b0cb79 + 40ff880 commit 5642185

294 files changed

Lines changed: 2880 additions & 8 deletions

File tree

Some content is hidden

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

.ci/semgrep/acctest/disappears.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ rules:
5959
- "/internal/service/a*/*_test.go"
6060
- "/internal/service/b*/*_test.go"
6161
- "/internal/service/c*/*_test.go"
62+
- "/internal/service/d*/*_test.go"
63+
- "/internal/service/e*/*_test.go"
6264
- "/internal/service/networkflowmonitor/*_test.go"
6365
- "/internal/service/notifications/*_test.go"
6466
- "/internal/service/notificationscontacts/*_test.go"

internal/service/dataexchange/data_set_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"github.com/YakDriver/regexache"
1212
"github.com/aws/aws-sdk-go-v2/service/dataexchange"
1313
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
14+
"github.com/hashicorp/terraform-plugin-testing/plancheck"
1415
"github.com/hashicorp/terraform-plugin-testing/terraform"
1516
"github.com/hashicorp/terraform-provider-aws/internal/acctest"
1617
"github.com/hashicorp/terraform-provider-aws/internal/retry"
@@ -125,6 +126,14 @@ func TestAccDataExchangeDataSet_disappears(t *testing.T) {
125126
acctest.CheckSDKResourceDisappears(ctx, t, tfdataexchange.ResourceDataSet(), resourceName),
126127
),
127128
ExpectNonEmptyPlan: true,
129+
ConfigPlanChecks: resource.ConfigPlanChecks{
130+
PreApply: []plancheck.PlanCheck{
131+
plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate),
132+
},
133+
PostApplyPostRefresh: []plancheck.PlanCheck{
134+
plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate),
135+
},
136+
},
128137
},
129138
},
130139
})

internal/service/dataexchange/event_action_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"github.com/aws/aws-sdk-go-v2/service/dataexchange"
1414
"github.com/hashicorp/terraform-plugin-testing/compare"
1515
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
16+
"github.com/hashicorp/terraform-plugin-testing/plancheck"
1617
"github.com/hashicorp/terraform-plugin-testing/statecheck"
1718
"github.com/hashicorp/terraform-plugin-testing/terraform"
1819
"github.com/hashicorp/terraform-plugin-testing/tfjsonpath"
@@ -182,6 +183,14 @@ func TestAccDataExchangeEventAction_disappears(t *testing.T) {
182183
acctest.CheckFrameworkResourceDisappears(ctx, t, tfdataexchange.ResourceEventAction, resourceName),
183184
),
184185
ExpectNonEmptyPlan: true,
186+
ConfigPlanChecks: resource.ConfigPlanChecks{
187+
PreApply: []plancheck.PlanCheck{
188+
plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate),
189+
},
190+
PostApplyPostRefresh: []plancheck.PlanCheck{
191+
plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate),
192+
},
193+
},
185194
},
186195
},
187196
})

internal/service/dataexchange/revision_assets_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
"github.com/aws/aws-sdk-go-v2/service/dataexchange"
1515
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
1616
"github.com/hashicorp/terraform-plugin-testing/knownvalue"
17+
"github.com/hashicorp/terraform-plugin-testing/plancheck"
1718
"github.com/hashicorp/terraform-plugin-testing/statecheck"
1819
"github.com/hashicorp/terraform-plugin-testing/terraform"
1920
"github.com/hashicorp/terraform-plugin-testing/tfjsonpath"
@@ -157,6 +158,14 @@ func TestAccDataExchangeRevisionAssets_disappears(t *testing.T) {
157158
acctest.CheckFrameworkResourceDisappears(ctx, t, tfdataexchange.ResourceRevisionAssets, resourceName),
158159
),
159160
ExpectNonEmptyPlan: true,
161+
ConfigPlanChecks: resource.ConfigPlanChecks{
162+
PreApply: []plancheck.PlanCheck{
163+
plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate),
164+
},
165+
PostApplyPostRefresh: []plancheck.PlanCheck{
166+
plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate),
167+
},
168+
},
160169
},
161170
},
162171
})

internal/service/dataexchange/revision_test.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"github.com/aws/aws-sdk-go-v2/service/dataexchange"
1212
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
1313
"github.com/hashicorp/terraform-plugin-testing/knownvalue"
14+
"github.com/hashicorp/terraform-plugin-testing/plancheck"
1415
"github.com/hashicorp/terraform-plugin-testing/statecheck"
1516
"github.com/hashicorp/terraform-plugin-testing/terraform"
1617
"github.com/hashicorp/terraform-plugin-testing/tfjsonpath"
@@ -119,6 +120,14 @@ func TestAccDataExchangeRevision_disappears(t *testing.T) {
119120
acctest.CheckSDKResourceDisappears(ctx, t, tfdataexchange.ResourceRevision(), resourceName),
120121
),
121122
ExpectNonEmptyPlan: true,
123+
ConfigPlanChecks: resource.ConfigPlanChecks{
124+
PreApply: []plancheck.PlanCheck{
125+
plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate),
126+
},
127+
PostApplyPostRefresh: []plancheck.PlanCheck{
128+
plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate),
129+
},
130+
},
122131
},
123132
},
124133
})
@@ -144,6 +153,14 @@ func TestAccDataExchangeRevision_disappears_dataSet(t *testing.T) {
144153
acctest.CheckSDKResourceDisappears(ctx, t, tfdataexchange.ResourceRevision(), resourceName),
145154
),
146155
ExpectNonEmptyPlan: true,
156+
ConfigPlanChecks: resource.ConfigPlanChecks{
157+
PreApply: []plancheck.PlanCheck{
158+
plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate),
159+
},
160+
PostApplyPostRefresh: []plancheck.PlanCheck{
161+
plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate),
162+
},
163+
},
147164
},
148165
},
149166
})

internal/service/datapipeline/pipeline_definition_test.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"github.com/aws/aws-sdk-go-v2/service/datapipeline"
1313
awstypes "github.com/aws/aws-sdk-go-v2/service/datapipeline/types"
1414
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
15+
"github.com/hashicorp/terraform-plugin-testing/plancheck"
1516
"github.com/hashicorp/terraform-plugin-testing/terraform"
1617
"github.com/hashicorp/terraform-provider-aws/internal/acctest"
1718
"github.com/hashicorp/terraform-provider-aws/internal/errs"
@@ -68,7 +69,15 @@ func TestAccDataPipelinePipelineDefinition_disappears(t *testing.T) {
6869
testAccCheckPipelineDefinitionExists(ctx, t, resourceName, &pipelineOutput),
6970
acctest.CheckSDKResourceDisappears(ctx, t, tfdatapipeline.ResourcePipelineDefinition(), resourceName),
7071
),
71-
},
72+
ExpectNonEmptyPlan: true,
73+
ConfigPlanChecks: resource.ConfigPlanChecks{
74+
PreApply: []plancheck.PlanCheck{
75+
plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate),
76+
},
77+
PostApplyPostRefresh: []plancheck.PlanCheck{
78+
plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate),
79+
},
80+
}},
7281
},
7382
})
7483
}

internal/service/datasync/location_azure_blob_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"github.com/YakDriver/regexache"
1212
"github.com/aws/aws-sdk-go-v2/service/datasync"
1313
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
14+
"github.com/hashicorp/terraform-plugin-testing/plancheck"
1415
"github.com/hashicorp/terraform-plugin-testing/terraform"
1516
"github.com/hashicorp/terraform-provider-aws/internal/acctest"
1617
"github.com/hashicorp/terraform-provider-aws/internal/retry"
@@ -76,6 +77,14 @@ func TestAccDataSyncLocationAzureBlob_disappears(t *testing.T) {
7677
acctest.CheckSDKResourceDisappears(ctx, t, tfdatasync.ResourceLocationAzureBlob(), resourceName),
7778
),
7879
ExpectNonEmptyPlan: true,
80+
ConfigPlanChecks: resource.ConfigPlanChecks{
81+
PreApply: []plancheck.PlanCheck{
82+
plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate),
83+
},
84+
PostApplyPostRefresh: []plancheck.PlanCheck{
85+
plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate),
86+
},
87+
},
7988
},
8089
},
8190
})

internal/service/datasync/location_efs_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"github.com/YakDriver/regexache"
1212
"github.com/aws/aws-sdk-go-v2/service/datasync"
1313
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
14+
"github.com/hashicorp/terraform-plugin-testing/plancheck"
1415
"github.com/hashicorp/terraform-plugin-testing/terraform"
1516
"github.com/hashicorp/terraform-provider-aws/internal/acctest"
1617
"github.com/hashicorp/terraform-provider-aws/internal/retry"
@@ -104,6 +105,14 @@ func TestAccDataSyncLocationEFS_disappears(t *testing.T) {
104105
acctest.CheckSDKResourceDisappears(ctx, t, tfdatasync.ResourceLocationEFS(), resourceName),
105106
),
106107
ExpectNonEmptyPlan: true,
108+
ConfigPlanChecks: resource.ConfigPlanChecks{
109+
PreApply: []plancheck.PlanCheck{
110+
plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate),
111+
},
112+
PostApplyPostRefresh: []plancheck.PlanCheck{
113+
plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate),
114+
},
115+
},
107116
},
108117
},
109118
})

internal/service/datasync/location_fsx_lustre_file_system_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"github.com/YakDriver/regexache"
1212
"github.com/aws/aws-sdk-go-v2/service/datasync"
1313
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
14+
"github.com/hashicorp/terraform-plugin-testing/plancheck"
1415
"github.com/hashicorp/terraform-plugin-testing/terraform"
1516
"github.com/hashicorp/terraform-provider-aws/internal/acctest"
1617
"github.com/hashicorp/terraform-provider-aws/internal/retry"
@@ -80,6 +81,14 @@ func TestAccDataSyncLocationFSxLustreFileSystem_disappears(t *testing.T) {
8081
acctest.CheckSDKResourceDisappears(ctx, t, tfdatasync.ResourceLocationFSxLustreFileSystem(), resourceName),
8182
),
8283
ExpectNonEmptyPlan: true,
84+
ConfigPlanChecks: resource.ConfigPlanChecks{
85+
PreApply: []plancheck.PlanCheck{
86+
plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate),
87+
},
88+
PostApplyPostRefresh: []plancheck.PlanCheck{
89+
plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate),
90+
},
91+
},
8392
},
8493
},
8594
})

internal/service/datasync/location_fsx_ontap_file_system_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"github.com/YakDriver/regexache"
1212
"github.com/aws/aws-sdk-go-v2/service/datasync"
1313
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
14+
"github.com/hashicorp/terraform-plugin-testing/plancheck"
1415
"github.com/hashicorp/terraform-plugin-testing/terraform"
1516
"github.com/hashicorp/terraform-provider-aws/internal/acctest"
1617
"github.com/hashicorp/terraform-provider-aws/internal/retry"
@@ -87,6 +88,14 @@ func TestAccDataSyncLocationFSxONTAPFileSystem_disappears(t *testing.T) {
8788
acctest.CheckSDKResourceDisappears(ctx, t, tfdatasync.ResourceLocationFSxONTAPFileSystem(), resourceName),
8889
),
8990
ExpectNonEmptyPlan: true,
91+
ConfigPlanChecks: resource.ConfigPlanChecks{
92+
PreApply: []plancheck.PlanCheck{
93+
plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate),
94+
},
95+
PostApplyPostRefresh: []plancheck.PlanCheck{
96+
plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate),
97+
},
98+
},
9099
},
91100
},
92101
})

0 commit comments

Comments
 (0)