|
18 | 18 | package {{ $.Res.PackageName }}_test |
19 | 19 |
|
20 | 20 | import ( |
21 | | -{{- if not $.Res.ExcludeDelete }} |
| 21 | + {{- if not $.Res.ExcludeDelete }} |
22 | 22 | {{- if not $.Res.CustomCode.TestCheckDestroy }} |
23 | 23 | "fmt" |
24 | 24 | {{- end }} |
25 | 25 | "strings" |
26 | | -{{- end }} |
| 26 | + {{- end }} |
27 | 27 | "testing" |
28 | 28 |
|
29 | 29 | "github.com/hashicorp/terraform-plugin-testing/helper/resource" |
30 | 30 | {{- if not $.Res.ExcludeDelete }} |
31 | 31 | "github.com/hashicorp/terraform-plugin-testing/terraform" |
32 | 32 | {{- end }} |
| 33 | + "github.com/hashicorp/terraform-plugin-testing/knownvalue" |
| 34 | + "github.com/hashicorp/terraform-plugin-testing/statecheck" |
| 35 | + "github.com/hashicorp/terraform-plugin-testing/tfjsonpath" |
| 36 | + "github.com/hashicorp/terraform-plugin-testing/tfversion" |
33 | 37 |
|
34 | 38 | "{{ $.ImportPath }}/acctest" |
35 | 39 | "{{ $.ImportPath }}/envvar" |
36 | 40 | "{{ $.ImportPath }}/tpgresource" |
37 | 41 | transport_tpg "{{ $.ImportPath }}/transport" |
38 | 42 | ) |
39 | | -{{ range $e := $.Res.TestExamples }} |
| 43 | +{{ range $i, $e := $.Res.TestExamples }} |
40 | 44 | func TestAcc{{ $e.TestSlug $.Res.ProductMetadata.Name $.Res.Name }}(t *testing.T) { |
41 | 45 | {{- if $e.SkipTest }} |
42 | 46 | t.Skip("{{$e.SkipTest}}") |
@@ -96,6 +100,17 @@ func TestAcc{{ $e.TestSlug $.Res.ProductMetadata.Name $.Res.Name }}(t *testing.T |
96 | 100 | ImportStateVerifyIgnore: {{ $.Res.IgnoreReadPropertiesToString $e }}, |
97 | 101 | {{- end }} |
98 | 102 | }, |
| 103 | + {{- end }} |
| 104 | + {{- if eq $i 0 }} |
| 105 | + {{- if lt (index $.Res.ProductMetadata.ApiName 0) 'a' }} |
| 106 | + |
| 107 | + { |
| 108 | + ResourceName: "{{ $.Res.TerraformName }}.{{ $e.PrimaryResourceId }}", |
| 109 | + RefreshState: true, |
| 110 | + ExpectNonEmptyPlan: true, |
| 111 | + ImportStateKind: resource.ImportBlockWithResourceIdentity, |
| 112 | + }, |
| 113 | + {{- end }} |
99 | 114 | {{- end }} |
100 | 115 | }, |
101 | 116 | }) |
|
0 commit comments