Skip to content

Commit d72e798

Browse files
committed
Rename test functions for consistency and for running by pattern
1 parent 58900fa commit d72e798

File tree

6 files changed

+14
-16
lines changed

6 files changed

+14
-16
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
@@ -18,7 +18,7 @@ import (
1818
r "github.com/hashicorp/terraform-plugin-testing/helper/resource"
1919
)
2020

21-
func Test_ImportBlock_AsFirstStep(t *testing.T) {
21+
func TestImportBlock_AsFirstStep(t *testing.T) {
2222
t.Parallel()
2323

2424
r.UnitTest(t, r.TestCase{

helper/resource/importstate/import_block_in_config_directory_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616
r "github.com/hashicorp/terraform-plugin-testing/helper/resource"
1717
)
1818

19-
func Test_ImportBlock_InConfigDirectory(t *testing.T) {
19+
func TestImportBlock_InConfigDirectory(t *testing.T) {
2020
t.Parallel()
2121

2222
r.UnitTest(t, r.TestCase{

helper/resource/importstate/import_block_in_config_file_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616
r "github.com/hashicorp/terraform-plugin-testing/helper/resource"
1717
)
1818

19-
func Test_ImportBlock_InConfigFile(t *testing.T) {
19+
func TestImportBlock_InConfigFile(t *testing.T) {
2020
t.Parallel()
2121

2222
r.UnitTest(t, r.TestCase{

helper/resource/importstate/import_block_with_id_test.go

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
r "github.com/hashicorp/terraform-plugin-testing/helper/resource"
2222
)
2323

24-
func Test_TestStep_ImportBlockId(t *testing.T) {
24+
func TestImportBlock_WithID(t *testing.T) {
2525
t.Parallel()
2626

2727
r.UnitTest(t, r.TestCase{
@@ -52,7 +52,7 @@ func Test_TestStep_ImportBlockId(t *testing.T) {
5252
})
5353
}
5454

55-
func TestTest_TestStep_ImportBlockId_ExpectError(t *testing.T) {
55+
func TestImportBlock_WithID_ExpectError(t *testing.T) {
5656
t.Parallel()
5757

5858
r.UnitTest(t, r.TestCase{
@@ -89,7 +89,7 @@ func TestTest_TestStep_ImportBlockId_ExpectError(t *testing.T) {
8989
})
9090
}
9191

92-
func TestTest_TestStep_ImportBlockId_FailWhenPlannableImportIsNotSupported(t *testing.T) {
92+
func TestImportBlock_WithID_FailWhenNotSupported(t *testing.T) {
9393
t.Parallel()
9494

9595
r.UnitTest(t, r.TestCase{
@@ -128,7 +128,7 @@ func TestTest_TestStep_ImportBlockId_FailWhenPlannableImportIsNotSupported(t *te
128128
})
129129
}
130130

131-
func TestTest_TestStep_ImportBlockId_SkipDataSourceState(t *testing.T) {
131+
func TestImportBlock_WithID_SkipsDataSources(t *testing.T) {
132132
t.Parallel()
133133

134134
r.UnitTest(t, r.TestCase{
@@ -172,9 +172,7 @@ func TestTest_TestStep_ImportBlockId_SkipDataSourceState(t *testing.T) {
172172
})
173173
}
174174

175-
// These tests currently pass but only because the `getState` function which is used on the imported resource
176-
// to do the state comparison doesn't return an error if there is no state in the working directory
177-
func TestTest_TestStep_ImportBlockId_ImportStateVerifyIgnore_Real_Example(t *testing.T) {
175+
func TestImportBlock_WithID_WithBlankOptionalAttribute_GeneratesCorrectPlan(t *testing.T) {
178176
/*
179177
This test tries to imitate a real world example of behaviour we often see in the AzureRM provider which requires
180178
the use of `ImportStateVerifyIgnore` when testing the import of a resource using the import command.
@@ -296,7 +294,7 @@ func TestTest_TestStep_ImportBlockId_ImportStateVerifyIgnore_Real_Example(t *tes
296294
})
297295
}
298296

299-
func TestTest_TestStep_ImportBlockId_ImportStateVerifyIgnore(t *testing.T) {
297+
func TestImportBlock_WithID_WithBlankComputedAttribute_GeneratesCorrectPlan(t *testing.T) {
300298
t.Parallel()
301299

302300
r.UnitTest(t, r.TestCase{

helper/resource/importstate/import_command_as_first_step_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717
r "github.com/hashicorp/terraform-plugin-testing/helper/resource"
1818
)
1919

20-
func Test_ImportCommand_AsFirstStep(t *testing.T) {
20+
func TestImportCommand_AsFirstStep(t *testing.T) {
2121
t.Parallel()
2222

2323
r.UnitTest(t, r.TestCase{

helper/resource/importstate/import_command_with_id_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
"github.com/hashicorp/terraform-plugin-testing/tfversion"
2121
)
2222

23-
func Test_TestStep_ImportStateCheck_SkipDataSourceState(t *testing.T) {
23+
func TestImportCommand_ImportStateCheckSkipsDataSources(t *testing.T) {
2424
t.Parallel()
2525

2626
r.UnitTest(t, r.TestCase{
@@ -123,7 +123,7 @@ func Test_TestStep_ImportStateCheck_SkipDataSourceState(t *testing.T) {
123123
})
124124
}
125125

126-
func Test_TestStep_ImportStateVerify(t *testing.T) {
126+
func TestImportCommand_ImportStateVerify(t *testing.T) {
127127
t.Parallel()
128128

129129
r.UnitTest(t, r.TestCase{
@@ -197,7 +197,7 @@ func Test_TestStep_ImportStateVerify(t *testing.T) {
197197
})
198198
}
199199

200-
func Test_TestStep_ImportStateVerifyIgnore(t *testing.T) {
200+
func TestImportCommand_ImportStateVerify_Ignore(t *testing.T) {
201201
t.Parallel()
202202

203203
r.UnitTest(t, r.TestCase{
@@ -281,7 +281,7 @@ func Test_TestStep_ImportStateVerifyIgnore(t *testing.T) {
281281
})
282282
}
283283

284-
func Test_TestStep_ExpectError_ImportState(t *testing.T) {
284+
func TestImportCommand_ExpectError(t *testing.T) {
285285
t.Parallel()
286286

287287
r.UnitTest(t, r.TestCase{

0 commit comments

Comments
 (0)