@@ -85,7 +85,7 @@ func TestGroupSyncTable(t *testing.T) {
85
85
testCases := []orgSetupDefinition {
86
86
{
87
87
Name : "SwitchGroups" ,
88
- Settings : & codersdk.GroupSyncSettings {
88
+ GroupSettings : & codersdk.GroupSyncSettings {
89
89
Field : "groups" ,
90
90
Mapping : map [string ][]uuid.UUID {
91
91
"foo" : {ids .ID ("sg-foo" ), ids .ID ("sg-foo-2" )},
@@ -113,7 +113,7 @@ func TestGroupSyncTable(t *testing.T) {
113
113
},
114
114
{
115
115
Name : "StayInGroup" ,
116
- Settings : & codersdk.GroupSyncSettings {
116
+ GroupSettings : & codersdk.GroupSyncSettings {
117
117
Field : "groups" ,
118
118
// Only match foo, so bar does not map
119
119
RegexFilter : regexp .MustCompile ("^foo$" ),
@@ -135,7 +135,7 @@ func TestGroupSyncTable(t *testing.T) {
135
135
},
136
136
{
137
137
Name : "UserJoinsGroups" ,
138
- Settings : & codersdk.GroupSyncSettings {
138
+ GroupSettings : & codersdk.GroupSyncSettings {
139
139
Field : "groups" ,
140
140
Mapping : map [string ][]uuid.UUID {
141
141
"foo" : {ids .ID ("ng-foo" ), uuid .New ()},
@@ -160,7 +160,7 @@ func TestGroupSyncTable(t *testing.T) {
160
160
},
161
161
{
162
162
Name : "CreateGroups" ,
163
- Settings : & codersdk.GroupSyncSettings {
163
+ GroupSettings : & codersdk.GroupSyncSettings {
164
164
Field : "groups" ,
165
165
RegexFilter : regexp .MustCompile ("^create" ),
166
166
AutoCreateMissing : true ,
@@ -175,7 +175,7 @@ func TestGroupSyncTable(t *testing.T) {
175
175
},
176
176
{
177
177
Name : "GroupNamesNoMapping" ,
178
- Settings : & codersdk.GroupSyncSettings {
178
+ GroupSettings : & codersdk.GroupSyncSettings {
179
179
Field : "groups" ,
180
180
RegexFilter : regexp .MustCompile (".*" ),
181
181
AutoCreateMissing : false ,
@@ -194,7 +194,7 @@ func TestGroupSyncTable(t *testing.T) {
194
194
},
195
195
{
196
196
Name : "NoUser" ,
197
- Settings : & codersdk.GroupSyncSettings {
197
+ GroupSettings : & codersdk.GroupSyncSettings {
198
198
Field : "groups" ,
199
199
Mapping : map [string ][]uuid.UUID {
200
200
// Extra ID that does not map to a group
@@ -219,7 +219,7 @@ func TestGroupSyncTable(t *testing.T) {
219
219
},
220
220
{
221
221
Name : "LegacyMapping" ,
222
- Settings : & codersdk.GroupSyncSettings {
222
+ GroupSettings : & codersdk.GroupSyncSettings {
223
223
Field : "groups" ,
224
224
RegexFilter : regexp .MustCompile ("^legacy" ),
225
225
LegacyNameMapping : map [string ]string {
@@ -401,7 +401,7 @@ func TestSyncDisabled(t *testing.T) {
401
401
ids .ID ("baz" ): false ,
402
402
ids .ID ("bop" ): false ,
403
403
},
404
- Settings : & codersdk.GroupSyncSettings {
404
+ GroupSettings : & codersdk.GroupSyncSettings {
405
405
Field : "groups" ,
406
406
Mapping : map [string ][]uuid.UUID {
407
407
"foo" : {ids .ID ("foo" )},
@@ -747,11 +747,15 @@ func SetupOrganization(t *testing.T, s *idpsync.AGPLIDPSync, db database.Store,
747
747
748
748
manager := runtimeconfig .NewManager ()
749
749
orgResolver := manager .OrganizationResolver (db , org .ID )
750
- err = s .Group .SetRuntimeValue (context .Background (), orgResolver , def .GroupSettings )
751
- require .NoError (t , err )
750
+ if def .GroupSettings != nil {
751
+ err = s .Group .SetRuntimeValue (context .Background (), orgResolver , (* idpsync .GroupSyncSettings )(def .GroupSettings ))
752
+ require .NoError (t , err )
753
+ }
752
754
753
- err = s .Role .SetRuntimeValue (context .Background (), orgResolver , def .RoleSettings )
754
- require .NoError (t , err )
755
+ if def .RoleSettings != nil {
756
+ err = s .Role .SetRuntimeValue (context .Background (), orgResolver , def .RoleSettings )
757
+ require .NoError (t , err )
758
+ }
755
759
756
760
if ! def .NotMember {
757
761
dbgen .OrganizationMember (t , db , database.OrganizationMember {
@@ -822,7 +826,7 @@ type orgSetupDefinition struct {
822
826
// NotMember if true will ensure the user is not a member of the organization.
823
827
NotMember bool
824
828
825
- GroupSettings * idpsync .GroupSyncSettings
829
+ GroupSettings * codersdk .GroupSyncSettings
826
830
RoleSettings * idpsync.RoleSyncSettings
827
831
828
832
assertGroups * orgGroupAssert
0 commit comments