From 723bc4c111b0165683047bfab898ef8022bea08f Mon Sep 17 00:00:00 2001 From: Devtools Date: Tue, 17 Sep 2024 10:14:52 +0200 Subject: [PATCH] fix an already existing bug --- pkg/kubeclient/signup.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pkg/kubeclient/signup.go b/pkg/kubeclient/signup.go index 831f6bf1..596f71fe 100644 --- a/pkg/kubeclient/signup.go +++ b/pkg/kubeclient/signup.go @@ -99,8 +99,9 @@ func (c *userSignupClient) listActiveSignupsByLabelForHashedValue(labelKey, valu // label matching the specified label func (c *userSignupClient) listActiveSignupsByLabel(labelKey, labelValue string) ([]*crtapi.UserSignup, error) { + // TODO add unit tests checking that the label selection works as expected. Right now, it's not possible to do that thanks to the great abstraction and multiple level of layers, mocks, and services. selector := labels.NewSelector() - stateRequirement, err := labels.NewRequirement(crtapi.UserSignupStateLabelKey, selection.NotEquals, []string{crtapi.UserSignupStateLabelValueDeactivated}) + stateRequirement, err := labels.NewRequirement(crtapi.UserSignupStateLabelKey, selection.NotIn, []string{crtapi.UserSignupStateLabelValueDeactivated, crtapi.UserSignupStateLabelValueNotReady}) if err != nil { return nil, err } @@ -120,9 +121,7 @@ func (c *userSignupClient) listActiveSignupsByLabel(labelKey, labelValue string) result := make([]*crtapi.UserSignup, len(userSignups.Items)) for i := range userSignups.Items { - userSignup := &crtapi.UserSignup{} - err = c.crtClient.scheme.Convert(userSignups.Items[i], userSignup, nil) - result[i] = userSignup + result[i] = &userSignups.Items[i] } return result, err