@@ -85,7 +85,7 @@ func TestGroupSyncTable(t *testing.T) {
8585testCases := []orgSetupDefinition {
8686{
8787Name :"SwitchGroups" ,
88- Settings :& codersdk.GroupSyncSettings {
88+ GroupSettings :& codersdk.GroupSyncSettings {
8989Field :"groups" ,
9090Mapping :map [string ][]uuid.UUID {
9191"foo" : {ids .ID ("sg-foo" ),ids .ID ("sg-foo-2" )},
@@ -113,7 +113,7 @@ func TestGroupSyncTable(t *testing.T) {
113113},
114114{
115115Name :"StayInGroup" ,
116- Settings :& codersdk.GroupSyncSettings {
116+ GroupSettings :& codersdk.GroupSyncSettings {
117117Field :"groups" ,
118118// Only match foo, so bar does not map
119119RegexFilter :regexp .MustCompile ("^foo$" ),
@@ -135,7 +135,7 @@ func TestGroupSyncTable(t *testing.T) {
135135},
136136{
137137Name :"UserJoinsGroups" ,
138- Settings :& codersdk.GroupSyncSettings {
138+ GroupSettings :& codersdk.GroupSyncSettings {
139139Field :"groups" ,
140140Mapping :map [string ][]uuid.UUID {
141141"foo" : {ids .ID ("ng-foo" ),uuid .New ()},
@@ -160,7 +160,7 @@ func TestGroupSyncTable(t *testing.T) {
160160},
161161{
162162Name :"CreateGroups" ,
163- Settings :& codersdk.GroupSyncSettings {
163+ GroupSettings :& codersdk.GroupSyncSettings {
164164Field :"groups" ,
165165RegexFilter :regexp .MustCompile ("^create" ),
166166AutoCreateMissing :true ,
@@ -175,7 +175,7 @@ func TestGroupSyncTable(t *testing.T) {
175175},
176176{
177177Name :"GroupNamesNoMapping" ,
178- Settings :& codersdk.GroupSyncSettings {
178+ GroupSettings :& codersdk.GroupSyncSettings {
179179Field :"groups" ,
180180RegexFilter :regexp .MustCompile (".*" ),
181181AutoCreateMissing :false ,
@@ -194,7 +194,7 @@ func TestGroupSyncTable(t *testing.T) {
194194},
195195{
196196Name :"NoUser" ,
197- Settings :& codersdk.GroupSyncSettings {
197+ GroupSettings :& codersdk.GroupSyncSettings {
198198Field :"groups" ,
199199Mapping :map [string ][]uuid.UUID {
200200// Extra ID that does not map to a group
@@ -219,7 +219,7 @@ func TestGroupSyncTable(t *testing.T) {
219219},
220220{
221221Name :"LegacyMapping" ,
222- Settings :& codersdk.GroupSyncSettings {
222+ GroupSettings :& codersdk.GroupSyncSettings {
223223Field :"groups" ,
224224RegexFilter :regexp .MustCompile ("^legacy" ),
225225LegacyNameMapping :map [string ]string {
@@ -401,7 +401,7 @@ func TestSyncDisabled(t *testing.T) {
401401ids .ID ("baz" ):false ,
402402ids .ID ("bop" ):false ,
403403},
404- Settings :& codersdk.GroupSyncSettings {
404+ GroupSettings :& codersdk.GroupSyncSettings {
405405Field :"groups" ,
406406Mapping :map [string ][]uuid.UUID {
407407"foo" : {ids .ID ("foo" )},
@@ -747,11 +747,15 @@ func SetupOrganization(t *testing.T, s *idpsync.AGPLIDPSync, db database.Store,
747747
748748manager := runtimeconfig .NewManager ()
749749orgResolver := 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+ }
752754
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+ }
755759
756760if ! def .NotMember {
757761dbgen .OrganizationMember (t ,db , database.OrganizationMember {
@@ -822,7 +826,7 @@ type orgSetupDefinition struct {
822826// NotMember if true will ensure the user is not a member of the organization.
823827NotMember bool
824828
825- GroupSettings * idpsync .GroupSyncSettings
829+ GroupSettings * codersdk .GroupSyncSettings
826830RoleSettings * idpsync.RoleSyncSettings
827831
828832assertGroups * orgGroupAssert