Skip to content

Commit 07b1779

Browse files
committed
Rename to step.ConfigExact
1 parent 2ef656a commit 07b1779

File tree

3 files changed

+21
-15
lines changed

3 files changed

+21
-15
lines changed

helper/resource/importstate/import_block_in_config_directory_test.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ func TestImportBlock_InConfigDirectory(t *testing.T) {
3535
ConfigDirectory: config.StaticDirectory(`testdata/1`),
3636
},
3737
{
38-
ResourceName: "examplecloud_container.test",
39-
ImportState: true,
40-
ImportStateKind: r.ImportBlockWithID,
41-
ImportStateReadOnlyConfig: true, // TODO: naming
42-
ConfigDirectory: config.StaticDirectory(`testdata/2`),
38+
ResourceName: "examplecloud_container.test",
39+
ImportState: true,
40+
ImportStateKind: r.ImportBlockWithID,
41+
ConfigDirectory: config.StaticDirectory(`testdata/2`),
42+
ConfigExact: true,
4343
},
4444
},
4545
})
@@ -64,11 +64,11 @@ func TestImportBlock_InConfigDirectory_Writeable(t *testing.T) {
6464
ConfigDirectory: config.StaticDirectory(`testdata/1`),
6565
},
6666
{
67-
ResourceName: "examplecloud_container.test",
68-
ImportState: true,
69-
ImportStateKind: r.ImportBlockWithID,
70-
ImportStateReadOnlyConfig: false,
71-
ConfigDirectory: config.StaticDirectory(`testdata/writeable-config-directory`),
67+
ResourceName: "examplecloud_container.test",
68+
ImportState: true,
69+
ImportStateKind: r.ImportBlockWithID,
70+
ConfigDirectory: config.StaticDirectory(`testdata/writeable-config-directory`),
71+
ConfigExact: false,
7272
},
7373
},
7474
})

helper/resource/testing.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,16 @@ 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
580+
// content of the Config, ConfigFile, or ConfigDirectory inputs and should
581+
// not modify it at test run time.
582+
//
583+
// The default is false. At test run time, the test framework will generate
584+
// specific kinds of configuration, such as import blocks, and append them
585+
// to the given Config, ConfigFile, or ConfigDirectory inputs. Using this
586+
// default improves test readability and removes duplication of setup.
587+
ConfigExact bool
588+
579589
// ConfigVariables is a map defining variables for use in conjunction
580590
// with Terraform configuration. If this map is populated then it
581591
// will be used to assemble an *.auto.tfvars.json which will be
@@ -666,10 +676,6 @@ type TestStep struct {
666676

667677
ImportStateKind ImportStateKind
668678

669-
// ImportStateReadOnlyConfig indicates that the test framework should not
670-
// modify ConfigFile or ConfigDirectory inputs to the test step.
671-
ImportStateReadOnlyConfig bool
672-
673679
// ImportStateId is the ID to perform an ImportState operation with.
674680
// This is optional. If it isn't set, then the resource ID is automatically
675681
// determined by inspecting the state for ResourceName's ID.

helper/resource/testing_new_import_state.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ func testStepNewImportState(ctx context.Context, t testing.T, helper *plugintest
135135
t.Fatal("Cannot import state with no specified config")
136136
}
137137

138-
case step.ImportStateReadOnlyConfig:
138+
case step.ConfigExact:
139139
break
140140

141141
case step.ConfigDirectory != nil:

0 commit comments

Comments
 (0)