Skip to content

Commit 712b939

Browse files
committed
Rename to ImportStateConfigExact and tidy comment
1 parent b74081a commit 712b939

File tree

7 files changed

+22
-23
lines changed

7 files changed

+22
-23
lines changed

helper/resource/importstate/import_block_as_first_step_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func TestImportBlock_AsFirstStep(t *testing.T) {
4848
id = "westeurope/somevalue"
4949
}
5050
`,
51-
ConfigExact: true,
51+
ImportStateConfigExact: true,
5252
ImportPlanChecks: r.ImportPlanChecks{
5353
PreApply: []plancheck.PlanCheck{
5454
plancheck.ExpectResourceAction("examplecloud_container.test", plancheck.ResourceActionNoop),

helper/resource/importstate/import_block_in_config_directory_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ func TestImportBlock_InConfigDirectory_ConfigExactTrue(t *testing.T) {
6969

7070
// This content includes an import block with an ID so we will
7171
// use the exact content
72-
ConfigDirectory: config.StaticDirectory(`testdata/2_with_exact_import_config`),
73-
ConfigExact: true,
72+
ConfigDirectory: config.StaticDirectory(`testdata/2_with_exact_import_config`),
73+
ImportStateConfigExact: true,
7474
},
7575
},
7676
})

helper/resource/importstate/import_block_in_config_file_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ func TestImportBlock_InConfigFile_ConfigExactTrue(t *testing.T) {
9797

9898
// This content includes an import block with an ID so we will
9999
// use the exact content
100-
ConfigFile: config.StaticFile(`testdata/examplecloud_container_with_exact_import_config_with_id.tf`),
101-
ConfigExact: true,
100+
ConfigFile: config.StaticFile(`testdata/examplecloud_container_with_exact_import_config_with_id.tf`),
101+
ImportStateConfigExact: true,
102102
},
103103
},
104104
})

helper/resource/importstate/import_block_with_id_test.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,11 @@ func TestImportBlock_WithID_ExpectError(t *testing.T) {
8989
id = "westeurope/somevalue"
9090
}
9191
`,
92-
ConfigExact: true,
93-
ResourceName: "examplecloud_container.test",
94-
ImportState: true,
95-
ImportStateKind: r.ImportBlockWithID,
96-
ExpectError: regexp.MustCompile(`importing resource examplecloud_container.test: expected a no-op import operation, got.*\["update"\] action with plan(.?)`),
92+
ResourceName: "examplecloud_container.test",
93+
ImportState: true,
94+
ImportStateKind: r.ImportBlockWithID,
95+
ImportStateConfigExact: true,
96+
ExpectError: regexp.MustCompile(`importing resource examplecloud_container.test: expected a no-op import operation, got.*\["update"\] action with plan(.?)`),
9797
},
9898
},
9999
})
@@ -296,10 +296,10 @@ func TestImportBlock_WithID_WithBlankOptionalAttribute_GeneratesCorrectPlan(t *t
296296
id = "sometestid"
297297
298298
}`,
299-
ConfigExact: true,
300-
ResourceName: "examplecloud_container.test",
301-
ImportState: true,
302-
ImportStateKind: r.ImportBlockWithID,
299+
ResourceName: "examplecloud_container.test",
300+
ImportState: true,
301+
ImportStateKind: r.ImportBlockWithID,
302+
ImportStateConfigExact: true,
303303
},
304304
},
305305
})
@@ -418,11 +418,11 @@ import {
418418
Config: config,
419419
},
420420
{
421-
ImportState: true,
422-
ImportStateKind: r.ImportBlockWithID,
423-
Config: configWithImportBlock,
424-
ConfigExact: true,
425-
ResourceName: "random_string.mystery_message",
421+
ImportState: true,
422+
ImportStateKind: r.ImportBlockWithID,
423+
ImportStateConfigExact: true,
424+
Config: configWithImportBlock,
425+
ResourceName: "random_string.mystery_message",
426426
ImportPlanChecks: r.ImportPlanChecks{
427427
PreApply: []plancheck.PlanCheck{
428428
plancheck.ExpectKnownValue(

helper/resource/testing.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -576,15 +576,15 @@ type TestStep struct {
576576
// otherwise an error will be returned.
577577
ConfigFile config.TestStepConfigFunc
578578

579-
// ConfigExact indicates that the test framework should use the exact
579+
// ImportStateConfigExact indicates that the test framework should use the exact
580580
// content of the Config, ConfigFile, or ConfigDirectory inputs and should
581581
// not modify it at test run time.
582582
//
583583
// The default is false. At test run time, the test framework will generate
584584
// specific kinds of configuration, such as import blocks, and append them
585585
// to the given Config, ConfigFile, or ConfigDirectory inputs. Using this
586586
// default improves test readability and removes duplication of setup.
587-
ConfigExact bool
587+
ImportStateConfigExact bool
588588

589589
// ConfigVariables is a map defining variables for use in conjunction
590590
// with Terraform configuration. If this map is populated then it

helper/resource/testing_new_import_state.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ func testStepNewImportState(ctx context.Context, t testing.T, helper *plugintest
123123
}.Exec())
124124

125125
switch {
126-
case step.ConfigExact:
126+
case step.ImportStateConfigExact:
127127
break
128128

129129
case kind.plannable() && kind.resourceIdentity():

internal/teststep/directory.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313

1414
var _ Config = configurationDirectory{}
1515

16-
// not threadsafe
1716
type configurationDirectory struct {
1817
directory string
1918

0 commit comments

Comments
 (0)