Skip to content

Commit e20ec92

Browse files
committed
Remove specialized tf import tests and merge to basic tests. Closes #434
1 parent a9b2eaa commit e20ec92

13 files changed

+270
-319
lines changed

internal/provider/resource_gitlab_group_cluster_test.go

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -97,22 +97,7 @@ func TestAccGitlabGroupCluster_basic(t *testing.T) {
9797
}),
9898
),
9999
},
100-
},
101-
})
102-
}
103-
104-
// lintignore: AT002 // TODO: Resolve this tfproviderlint issue
105-
func TestAccGitlabGroupCluster_import(t *testing.T) {
106-
rInt := acctest.RandInt()
107-
108-
resource.Test(t, resource.TestCase{
109-
PreCheck: func() { testAccRequiresLessThan(t, "15.0") },
110-
ProviderFactories: providerFactories,
111-
CheckDestroy: testAccCheckGitlabGroupClusterDestroy,
112-
Steps: []resource.TestStep{
113-
{
114-
Config: testAccGitlabGroupClusterConfig(rInt, true),
115-
},
100+
// Verify Import
116101
{
117102
ResourceName: "gitlab_group_cluster.foo",
118103
ImportState: true,

internal/provider/resource_gitlab_group_test.go

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ func TestAccGitlabGroup_basic(t *testing.T) {
4040
}),
4141
),
4242
},
43+
// Verify Import
44+
{
45+
ResourceName: "gitlab_group.foo",
46+
ImportState: true,
47+
ImportStateVerify: true,
48+
},
4349
// Update the group to change the description
4450
{
4551
Config: testAccGitlabGroupUpdateConfig(rInt, 1),
@@ -64,6 +70,12 @@ func TestAccGitlabGroup_basic(t *testing.T) {
6470
}),
6571
),
6672
},
73+
// Verify Import
74+
{
75+
ResourceName: "gitlab_group.foo",
76+
ImportState: true,
77+
ImportStateVerify: true,
78+
},
6779
// Update the group to use zero-value `default_branch_protection`
6880
{
6981
Config: testAccGitlabGroupUpdateConfig(rInt, 0),
@@ -88,6 +100,12 @@ func TestAccGitlabGroup_basic(t *testing.T) {
88100
}),
89101
),
90102
},
103+
// Verify Import
104+
{
105+
ResourceName: "gitlab_group.foo",
106+
ImportState: true,
107+
ImportStateVerify: true,
108+
},
91109
// Update the group to put the name and description back
92110
{
93111
Config: testAccGitlabGroupConfig(rInt),
@@ -106,21 +124,7 @@ func TestAccGitlabGroup_basic(t *testing.T) {
106124
}),
107125
),
108126
},
109-
},
110-
})
111-
}
112-
113-
// lintignore: AT002 // TODO: Resolve this tfproviderlint issue
114-
func TestAccGitlabGroup_import(t *testing.T) {
115-
rInt := acctest.RandInt()
116-
117-
resource.Test(t, resource.TestCase{
118-
ProviderFactories: providerFactories,
119-
CheckDestroy: testAccCheckGitlabGroupDestroy,
120-
Steps: []resource.TestStep{
121-
{
122-
Config: testAccGitlabGroupConfig(rInt),
123-
},
127+
// Verify Import
124128
{
125129
ResourceName: "gitlab_group.foo",
126130
ImportState: true,

internal/provider/resource_gitlab_instance_cluster_test.go

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -99,22 +99,7 @@ func TestAccGitlabInstanceCluster_basic(t *testing.T) {
9999
}),
100100
),
101101
},
102-
},
103-
})
104-
}
105-
106-
// lintignore: AT002 // TODO: Resolve this tfproviderlint issue
107-
func TestAccGitlabInstanceCluster_import(t *testing.T) {
108-
rInt := acctest.RandInt()
109-
110-
resource.Test(t, resource.TestCase{
111-
PreCheck: func() { testAccRequiresLessThan(t, "15.0") },
112-
ProviderFactories: providerFactories,
113-
CheckDestroy: testAccCheckGitlabInstanceClusterDestroy,
114-
Steps: []resource.TestStep{
115-
{
116-
Config: testAccGitlabInstanceClusterConfig(rInt, true),
117-
},
102+
// Verify Import
118103
{
119104
ResourceName: "gitlab_instance_cluster.foo",
120105
ImportState: true,

internal/provider/resource_gitlab_pipeline_schedule_test.go

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ func TestAccGitlabPipelineSchedule_basic(t *testing.T) {
3636
}),
3737
),
3838
},
39+
// Verify Import
40+
{
41+
ResourceName: "gitlab_pipeline_schedule.schedule",
42+
ImportStateIdFunc: getPipelineScheduleImportID("gitlab_pipeline_schedule.schedule"),
43+
ImportState: true,
44+
ImportStateVerify: true,
45+
},
3946
// Update the pipeline schedule to change the parameters
4047
{
4148
Config: testAccGitlabPipelineScheduleUpdateConfig(rInt),
@@ -50,6 +57,13 @@ func TestAccGitlabPipelineSchedule_basic(t *testing.T) {
5057
}),
5158
),
5259
},
60+
// Verify Import
61+
{
62+
ResourceName: "gitlab_pipeline_schedule.schedule",
63+
ImportStateIdFunc: getPipelineScheduleImportID("gitlab_pipeline_schedule.schedule"),
64+
ImportState: true,
65+
ImportStateVerify: true,
66+
},
5367
// Update the pipeline schedule to get back to initial settings
5468
{
5569
Config: testAccGitlabPipelineScheduleConfig(rInt),
@@ -64,25 +78,10 @@ func TestAccGitlabPipelineSchedule_basic(t *testing.T) {
6478
}),
6579
),
6680
},
67-
},
68-
})
69-
}
70-
71-
// lintignore: AT002 // TODO: Resolve this tfproviderlint issue
72-
func TestAccGitlabPipelineSchedule_import(t *testing.T) {
73-
rInt := acctest.RandInt()
74-
resourceName := "gitlab_pipeline_schedule.schedule"
75-
76-
resource.Test(t, resource.TestCase{
77-
ProviderFactories: providerFactories,
78-
CheckDestroy: testAccCheckGitlabPipelineScheduleDestroy,
79-
Steps: []resource.TestStep{
80-
{
81-
Config: testAccGitlabPipelineScheduleConfig(rInt),
82-
},
81+
// Verify Import
8382
{
84-
ResourceName: resourceName,
85-
ImportStateIdFunc: getPipelineScheduleImportID(resourceName),
83+
ResourceName: "gitlab_pipeline_schedule.schedule",
84+
ImportStateIdFunc: getPipelineScheduleImportID("gitlab_pipeline_schedule.schedule"),
8685
ImportState: true,
8786
ImportStateVerify: true,
8887
},

internal/provider/resource_gitlab_pipeline_schedule_variable_test.go

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ func TestAccGitlabPipelineScheduleVariable_basic(t *testing.T) {
2020

2121
resource.Test(t, resource.TestCase{
2222
ProviderFactories: providerFactories,
23-
CheckDestroy: testAccCheckGitlabProjectDestroy,
23+
CheckDestroy: testAccCheckGitlabPipelineScheduleVariableDestroy,
2424
Steps: []resource.TestStep{
2525
{
2626
Config: testAccGitlabPipelineScheduleVariableConfig(rInt),
@@ -32,6 +32,13 @@ func TestAccGitlabPipelineScheduleVariable_basic(t *testing.T) {
3232
}),
3333
),
3434
},
35+
// Verify Import
36+
{
37+
ResourceName: "gitlab_pipeline_schedule_variable.schedule_var",
38+
ImportState: true,
39+
ImportStateIdFunc: getPipelineScheduleVariableID("gitlab_pipeline_schedule_variable.schedule_var"),
40+
ImportStateVerify: true,
41+
},
3542
{
3643
Config: testAccGitlabPipelineScheduleVariableUpdateConfig(rInt),
3744
Check: resource.ComposeTestCheckFunc(
@@ -42,6 +49,13 @@ func TestAccGitlabPipelineScheduleVariable_basic(t *testing.T) {
4249
}),
4350
),
4451
},
52+
// Verify Import
53+
{
54+
ResourceName: "gitlab_pipeline_schedule_variable.schedule_var",
55+
ImportState: true,
56+
ImportStateIdFunc: getPipelineScheduleVariableID("gitlab_pipeline_schedule_variable.schedule_var"),
57+
ImportStateVerify: true,
58+
},
4559
{
4660
Config: testAccGitlabPipelineScheduleVariableConfig(rInt),
4761
Check: resource.ComposeTestCheckFunc(
@@ -52,26 +66,11 @@ func TestAccGitlabPipelineScheduleVariable_basic(t *testing.T) {
5266
}),
5367
),
5468
},
55-
},
56-
})
57-
}
58-
59-
// lintignore: AT002 // TODO: Resolve this tfproviderlint issue
60-
func TestAccGitlabPipelineScheduleVariable_import(t *testing.T) {
61-
rInt := acctest.RandInt()
62-
resourceName := "gitlab_pipeline_schedule_variable.schedule_var"
63-
64-
resource.Test(t, resource.TestCase{
65-
ProviderFactories: providerFactories,
66-
CheckDestroy: testAccCheckGitlabPipelineScheduleVariableDestroy,
67-
Steps: []resource.TestStep{
68-
{
69-
Config: testAccGitlabPipelineScheduleVariableConfig(rInt),
70-
},
69+
// Verify Import
7170
{
72-
ResourceName: resourceName,
71+
ResourceName: "gitlab_pipeline_schedule_variable.schedule_var",
7372
ImportState: true,
74-
ImportStateIdFunc: getPipelineScheduleVariableID(resourceName),
73+
ImportStateIdFunc: getPipelineScheduleVariableID("gitlab_pipeline_schedule_variable.schedule_var"),
7574
ImportStateVerify: true,
7675
},
7776
},

internal/provider/resource_gitlab_pipeline_trigger_test.go

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ func TestAccGitlabPipelineTrigger_basic(t *testing.T) {
3232
}),
3333
),
3434
},
35+
// Verify Import
36+
{
37+
ResourceName: "gitlab_pipeline_trigger.trigger",
38+
ImportStateIdFunc: getPipelineTriggerImportID("gitlab_pipeline_trigger.trigger"),
39+
ImportState: true,
40+
ImportStateVerify: true,
41+
},
3542
// Update the pipeline trigger to change the parameters
3643
{
3744
Config: testAccGitlabPipelineTriggerUpdateConfig(rInt),
@@ -42,6 +49,13 @@ func TestAccGitlabPipelineTrigger_basic(t *testing.T) {
4249
}),
4350
),
4451
},
52+
// Verify Import
53+
{
54+
ResourceName: "gitlab_pipeline_trigger.trigger",
55+
ImportStateIdFunc: getPipelineTriggerImportID("gitlab_pipeline_trigger.trigger"),
56+
ImportState: true,
57+
ImportStateVerify: true,
58+
},
4559
// Update the pipeline trigger to get back to initial settings
4660
{
4761
Config: testAccGitlabPipelineTriggerConfig(rInt),
@@ -52,25 +66,10 @@ func TestAccGitlabPipelineTrigger_basic(t *testing.T) {
5266
}),
5367
),
5468
},
55-
},
56-
})
57-
}
58-
59-
// lintignore: AT002 // TODO: Resolve this tfproviderlint issue
60-
func TestAccGitlabPipelineTrigger_import(t *testing.T) {
61-
rInt := acctest.RandInt()
62-
resourceName := "gitlab_pipeline_trigger.trigger"
63-
64-
resource.Test(t, resource.TestCase{
65-
ProviderFactories: providerFactories,
66-
CheckDestroy: testAccCheckGitlabPipelineTriggerDestroy,
67-
Steps: []resource.TestStep{
68-
{
69-
Config: testAccGitlabPipelineTriggerConfig(rInt),
70-
},
69+
// Verify Import
7170
{
72-
ResourceName: resourceName,
73-
ImportStateIdFunc: getPipelineTriggerImportID(resourceName),
71+
ResourceName: "gitlab_pipeline_trigger.trigger",
72+
ImportStateIdFunc: getPipelineTriggerImportID("gitlab_pipeline_trigger.trigger"),
7473
ImportState: true,
7574
ImportStateVerify: true,
7675
},

internal/provider/resource_gitlab_project_cluster_test.go

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -99,22 +99,7 @@ func TestAccGitlabProjectCluster_basic(t *testing.T) {
9999
}),
100100
),
101101
},
102-
},
103-
})
104-
}
105-
106-
// lintignore: AT002 // TODO: Resolve this tfproviderlint issue
107-
func TestAccGitlabProjectCluster_import(t *testing.T) {
108-
rInt := acctest.RandInt()
109-
110-
resource.Test(t, resource.TestCase{
111-
PreCheck: func() { testAccRequiresLessThan(t, "15.0") },
112-
ProviderFactories: providerFactories,
113-
CheckDestroy: testAccCheckGitlabProjectClusterDestroy,
114-
Steps: []resource.TestStep{
115-
{
116-
Config: testAccGitlabProjectClusterConfig(rInt, true),
117-
},
102+
// Verify Import
118103
{
119104
ResourceName: "gitlab_project_cluster.foo",
120105
ImportState: true,

internal/provider/resource_gitlab_project_freeze_period_test.go

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ func TestAccGitlabProjectFreezePeriod_basic(t *testing.T) {
3333
}),
3434
),
3535
},
36+
// Verify Import
37+
{
38+
ResourceName: "gitlab_project_freeze_period.schedule",
39+
ImportState: true,
40+
ImportStateVerify: true,
41+
},
3642
// Update the freeze period to change the parameters
3743
{
3844
Config: testAccGitlabProjectFreezePeriodUpdateConfig(rInt),
@@ -45,6 +51,12 @@ func TestAccGitlabProjectFreezePeriod_basic(t *testing.T) {
4551
}),
4652
),
4753
},
54+
// Verify Import
55+
{
56+
ResourceName: "gitlab_project_freeze_period.schedule",
57+
ImportState: true,
58+
ImportStateVerify: true,
59+
},
4860
// Update the freeze period to get back to initial settings
4961
{
5062
Config: testAccGitlabProjectFreezePeriodConfig(rInt),
@@ -57,21 +69,7 @@ func TestAccGitlabProjectFreezePeriod_basic(t *testing.T) {
5769
}),
5870
),
5971
},
60-
},
61-
})
62-
}
63-
64-
// lintignore: AT002 // TODO: Resolve this tfproviderlint issue
65-
func TestAccGitlabProjectFreezePeriod_import(t *testing.T) {
66-
rInt := acctest.RandInt()
67-
68-
resource.Test(t, resource.TestCase{
69-
ProviderFactories: providerFactories,
70-
CheckDestroy: testAccCheckGitlabProjectDestroy,
71-
Steps: []resource.TestStep{
72-
{
73-
Config: testAccGitlabProjectFreezePeriodConfig(rInt),
74-
},
72+
// Verify Import
7573
{
7674
ResourceName: "gitlab_project_freeze_period.schedule",
7775
ImportState: true,

0 commit comments

Comments
 (0)