@@ -176,7 +176,7 @@ func testStepNewImportState(ctx context.Context, t testing.T, helper *plugintest
176176 if kind .plannable () {
177177 return testImportBlock (ctx , t , workingDir , providers , resourceName , step , priorIdentityValues )
178178 } else {
179- return testImportCommand (ctx , t , err , workingDir , providers , resourceName , importId , step , state )
179+ return testImportCommand (ctx , t , workingDir , providers , resourceName , importId , step , state )
180180 }
181181}
182182
@@ -255,18 +255,15 @@ func verifyIdentityValues(ctx context.Context, t testing.T, workingDir *pluginte
255255 return nil
256256}
257257
258- func testImportCommand (ctx context.Context , t testing.T , err error , workingDir * plugintest.WorkingDir , providers * providerFactories , resourceName string , importId string , step TestStep , state * terraform.State ) error {
259- // TODO: extract to a function -- this is an implicit `else` for the long `if` above :)
260-
261- var importState * terraform.State
262-
263- err = runProviderCommand (ctx , t , workingDir , providers , func () error {
258+ func testImportCommand (ctx context.Context , t testing.T , workingDir * plugintest.WorkingDir , providers * providerFactories , resourceName string , importId string , step TestStep , state * terraform.State ) error {
259+ err := runProviderCommand (ctx , t , workingDir , providers , func () error {
264260 return workingDir .Import (ctx , resourceName , importId )
265261 })
266262 if err != nil {
267263 return err
268264 }
269265
266+ var importState * terraform.State
270267 err = runProviderCommand (ctx , t , workingDir , providers , func () error {
271268 _ , importState , err = getState (ctx , t , workingDir )
272269 if err != nil {
0 commit comments