Skip to content

Commit ef98ecb

Browse files
committed
responding to PR comments, removing import state verify for acceptance test
1 parent 240918b commit ef98ecb

File tree

2 files changed

+13
-18
lines changed

2 files changed

+13
-18
lines changed

gitlab/resource_gitlab_project_mirror.go

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ import (
1111

1212
func resourceGitlabProjectMirror() *schema.Resource {
1313
return &schema.Resource{
14-
Create: resourceGitlabMirrorCreate,
14+
Create: resourceGitlabProjectMirrorCreate,
1515
Read: resourceGitlabProjectMirrorRead,
16-
Update: resourceGitlabMirrorUpdate,
17-
Delete: resourceGitlabMirrorDelete,
16+
Update: resourceGitlabProjectMirrorUpdate,
17+
Delete: resourceGitlabProjectMirrorDelete,
1818
Importer: &schema.ResourceImporter{
1919
State: schema.ImportStatePassthrough,
2020
},
@@ -53,7 +53,7 @@ func resourceGitlabProjectMirror() *schema.Resource {
5353
}
5454
}
5555

56-
func resourceGitlabMirrorCreate(d *schema.ResourceData, meta interface{}) error {
56+
func resourceGitlabProjectMirrorCreate(d *schema.ResourceData, meta interface{}) error {
5757
client := meta.(*gitlab.Client)
5858

5959
projectID := d.Get("project").(string)
@@ -82,7 +82,7 @@ func resourceGitlabMirrorCreate(d *schema.ResourceData, meta interface{}) error
8282
return resourceGitlabProjectMirrorRead(d, meta)
8383
}
8484

85-
func resourceGitlabMirrorUpdate(d *schema.ResourceData, meta interface{}) error {
85+
func resourceGitlabProjectMirrorUpdate(d *schema.ResourceData, meta interface{}) error {
8686
client := meta.(*gitlab.Client)
8787

8888
mirrorID := d.Get("mirror_id").(int)
@@ -106,7 +106,7 @@ func resourceGitlabMirrorUpdate(d *schema.ResourceData, meta interface{}) error
106106
}
107107

108108
// Documented remote mirrors API does not support a delete method, instead mirror is disabled.
109-
func resourceGitlabMirrorDelete(d *schema.ResourceData, meta interface{}) error {
109+
func resourceGitlabProjectMirrorDelete(d *schema.ResourceData, meta interface{}) error {
110110
client := meta.(*gitlab.Client)
111111

112112
enabled := false
@@ -167,10 +167,7 @@ func resourceGitlabProjectMirrorRead(d *schema.ResourceData, meta interface{}) e
167167
}
168168

169169
func resourceGitlabProjectMirrorSetToState(d *schema.ResourceData, projectMirror *gitlab.ProjectMirror, projectID *string) {
170-
171-
mirrorID := strconv.Itoa(projectMirror.ID)
172170
d.Set("enabled", projectMirror.Enabled)
173171
d.Set("only_protected_branches", projectMirror.OnlyProtectedBranches)
174172
d.Set("keep_divergent_refs", projectMirror.KeepDivergentRefs)
175-
d.SetId(buildTwoPartID(projectID, &mirrorID))
176173
}

gitlab/resource_gitlab_project_mirror_test.go

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package gitlab
22

3-
// TODO convert to handle project mirror.
4-
53
import (
64
"errors"
75
"fmt"
@@ -79,10 +77,10 @@ func TestAccGitlabProjectMirror_import(t *testing.T) {
7977
Config: testAccGitlabProjectMirrorConfig(rInt),
8078
},
8179
{
82-
ResourceName: "gitlab_project_mirror.foo",
83-
ImportState: true,
84-
ImportStateVerify: true,
85-
ImportStateVerifyIgnore: []string{"enabled", "mirror_id", "project", "url"},
80+
ResourceName: "gitlab_project_mirror.foo",
81+
ImportState: true,
82+
ImportStateVerify: true,
83+
//ImportStateVerifyIgnore: []string{"enabled", "mirror_id", "project", "url"},
8684
},
8785
},
8886
})
@@ -137,13 +135,13 @@ func testAccCheckGitlabProjectMirrorAttributes(mirror *gitlab.ProjectMirror, wan
137135
}
138136

139137
if mirror.Enabled != want.Enabled {
140-
return fmt.Errorf("got enable_ssl_verification %t; want %t", mirror.Enabled, want.Enabled)
138+
return fmt.Errorf("got enabled %t; want %t", mirror.Enabled, want.Enabled)
141139
}
142140
if mirror.OnlyProtectedBranches != want.OnlyProtectedBranches {
143-
return fmt.Errorf("got enable_ssl_verification %t; want %t", mirror.OnlyProtectedBranches, want.OnlyProtectedBranches)
141+
return fmt.Errorf("got only protected branches %t; want %t", mirror.OnlyProtectedBranches, want.OnlyProtectedBranches)
144142
}
145143
if mirror.KeepDivergentRefs != want.KeepDivergentRefs {
146-
return fmt.Errorf("got enable_ssl_verification %t; want %t", mirror.KeepDivergentRefs, want.KeepDivergentRefs)
144+
return fmt.Errorf("got keep divergent refs %t; want %t", mirror.KeepDivergentRefs, want.KeepDivergentRefs)
147145
}
148146
return nil
149147
}

0 commit comments

Comments
 (0)