@@ -84,7 +84,7 @@ func TestAccGitlabProject_basic(t *testing.T) {
84
84
GroupID int
85
85
GroupName string
86
86
GroupAccessLevel int
87
- }{{0 , "" , 30 }},
87
+ }{{0 , fmt . Sprintf ( "foo-name-%d" , rInt ) , 30 }},
88
88
}),
89
89
),
90
90
},
@@ -106,7 +106,7 @@ func TestAccGitlabProject_basic(t *testing.T) {
106
106
GroupID int
107
107
GroupName string
108
108
GroupAccessLevel int
109
- }{{0 , " " , 30 }, {0 , " " , 10 }},
109
+ }{{0 , fmt . Sprintf ( "foo-name-%d " , rInt ), 10 }, {0 , fmt . Sprintf ( "foo2-name-%d " , rInt ), 30 }},
110
110
}),
111
111
),
112
112
},
@@ -251,11 +251,18 @@ func testAccCheckGitlabProjectAttributes(project *gitlab.Project, want *testAccG
251
251
return fmt .Errorf ("got visibility %q; want %q" , project .Visibility , want .Visibility )
252
252
}
253
253
254
- for i , group := range project .SharedWithGroups {
255
- if group .GroupAccessLevel != want .SharedWithGroups [i ].GroupAccessLevel {
256
- return fmt .Errorf ("got shared with groups access: %d; want %d" , group .GroupAccessLevel , want .SharedWithGroups [i ].GroupAccessLevel )
254
+ groupsToCheck := want .SharedWithGroups
255
+ for _ , group := range project .SharedWithGroups {
256
+ for i , groupToCheck := range groupsToCheck {
257
+ if group .GroupName == groupToCheck .GroupName && group .GroupAccessLevel == groupToCheck .GroupAccessLevel {
258
+ groupsToCheck = append (groupsToCheck [:i ], groupsToCheck [i + 1 :]... )
259
+ break
260
+ }
257
261
}
258
262
}
263
+ if len (groupsToCheck ) != 0 {
264
+ return fmt .Errorf ("got shared with groups: %v; want %v" , project .SharedWithGroups , want .SharedWithGroups )
265
+ }
259
266
260
267
return nil
261
268
}
0 commit comments