diff --git a/pkg/utils/user_group.go b/pkg/utils/user_group.go index 795c78f8..95aec74d 100644 --- a/pkg/utils/user_group.go +++ b/pkg/utils/user_group.go @@ -18,7 +18,6 @@ package utils import ( "sort" - "strings" ) type UserGroupList []string @@ -28,7 +27,7 @@ func (u UserGroupList) Len() int { } func (u UserGroupList) Less(i, j int) bool { - return strings.ToLower(u[i]) < strings.ToLower(u[j]) + return u[i] < u[j] } func (u UserGroupList) Swap(i, j int) { diff --git a/pkg/utils/user_group_test.go b/pkg/utils/user_group_test.go new file mode 100644 index 00000000..2a220f9b --- /dev/null +++ b/pkg/utils/user_group_test.go @@ -0,0 +1,23 @@ +package utils + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestIsInCapsuleGroup(t *testing.T) { + groups := []string{ + "DPS-QQ-DeparEE-Upload_RW", + "vsphere - glonqqqq-devopsq", + "OSAAA-WOO", + "crownuser-qq4", + "kubernetes-abilitytologin", + "waaazzz-prod-user", + "Zaxxxq_Global_Team_Leader_Automation", + } + + capsuleGroup := "kubernetes-abilitytologin" + + assert.True(t, UserGroupList(groups).IsInCapsuleGroup(capsuleGroup), nil) +}