|
8 | 8 | "regexp" |
9 | 9 | "testing" |
10 | 10 |
|
11 | | - "github.com/hashicorp/terraform-plugin-testing/internal/testing/testsdk/datasource" |
12 | 11 | "github.com/hashicorp/terraform-plugin-testing/terraform" |
13 | 12 |
|
14 | 13 | "github.com/hashicorp/terraform-plugin-go/tfprotov6" |
@@ -103,82 +102,21 @@ func TestTest_TestStep_ImportBlockId_SkipDataSourceState(t *testing.T) { |
103 | 102 | ProtoV6ProviderFactories: map[string]func() (tfprotov6.ProviderServer, error){ |
104 | 103 | "examplecloud": providerserver.NewProviderServer(testprovider.Provider{ |
105 | 104 | DataSources: map[string]testprovider.DataSource{ |
106 | | - "examplecloud_thing": { |
107 | | - ReadResponse: &datasource.ReadResponse{ |
108 | | - State: tftypes.NewValue( |
109 | | - tftypes.Object{ |
110 | | - AttributeTypes: map[string]tftypes.Type{ |
111 | | - "id": tftypes.String, |
112 | | - }, |
113 | | - }, |
114 | | - map[string]tftypes.Value{ |
115 | | - "id": tftypes.NewValue(tftypes.String, "datasource-test"), |
116 | | - }, |
117 | | - ), |
118 | | - }, |
119 | | - SchemaResponse: &datasource.SchemaResponse{ |
120 | | - Schema: &tfprotov6.Schema{ |
121 | | - Block: &tfprotov6.SchemaBlock{ |
122 | | - Attributes: []*tfprotov6.SchemaAttribute{ |
123 | | - { |
124 | | - Name: "id", |
125 | | - Type: tftypes.String, |
126 | | - Computed: true, |
127 | | - }, |
128 | | - }, |
129 | | - }, |
130 | | - }, |
131 | | - }, |
132 | | - }, |
| 105 | + "examplecloud_thing": examplecloudDataSource(), |
133 | 106 | }, |
134 | 107 | Resources: map[string]testprovider.Resource{ |
135 | | - "examplecloud_thing": { |
136 | | - CreateResponse: &resource.CreateResponse{ |
137 | | - NewState: tftypes.NewValue( |
138 | | - tftypes.Object{ |
139 | | - AttributeTypes: map[string]tftypes.Type{ |
140 | | - "id": tftypes.String, |
141 | | - }, |
142 | | - }, |
143 | | - map[string]tftypes.Value{ |
144 | | - "id": tftypes.NewValue(tftypes.String, "resource-test"), |
145 | | - }, |
146 | | - ), |
147 | | - }, |
148 | | - ImportStateResponse: &resource.ImportStateResponse{ |
149 | | - State: tftypes.NewValue( |
150 | | - tftypes.Object{ |
151 | | - AttributeTypes: map[string]tftypes.Type{ |
152 | | - "id": tftypes.String, |
153 | | - }, |
154 | | - }, |
155 | | - map[string]tftypes.Value{ |
156 | | - "id": tftypes.NewValue(tftypes.String, "resource-test"), |
157 | | - }, |
158 | | - ), |
159 | | - }, |
160 | | - SchemaResponse: &resource.SchemaResponse{ |
161 | | - Schema: &tfprotov6.Schema{ |
162 | | - Block: &tfprotov6.SchemaBlock{ |
163 | | - Attributes: []*tfprotov6.SchemaAttribute{ |
164 | | - { |
165 | | - Name: "id", |
166 | | - Type: tftypes.String, |
167 | | - Computed: true, |
168 | | - }, |
169 | | - }, |
170 | | - }, |
171 | | - }, |
172 | | - }, |
173 | | - }, |
| 108 | + "examplecloud_thing": examplecloudResource(), |
174 | 109 | }, |
175 | 110 | }), |
176 | 111 | }, |
177 | 112 | Steps: []r.TestStep{ |
178 | 113 | { |
179 | 114 | Config: ` |
180 | 115 | data "examplecloud_thing" "test" {} |
181 | | - resource "examplecloud_thing" "test" {} |
| 116 | + resource "examplecloud_thing" "test" { |
| 117 | + name = "somevalue" |
| 118 | + location = "westeurope" |
| 119 | + } |
182 | 120 | `, |
183 | 121 | }, |
184 | 122 | { |
|
0 commit comments