Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
Signed-off-by: SpiritZhou <[email protected]>
  • Loading branch information
SpiritZhou committed Jun 30, 2023
1 parent f1da759 commit 5324709
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
12 changes: 6 additions & 6 deletions controllers/keda/util/string_lists_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ func TestAppendString(t *testing.T) {
{"success", "viewer,editor", "owner", ",", "viewer,editor,owner"},
{"single_success", "viewer", "owner", ",", "viewer,owner"},
{"exist", "viewer,editor,owner", "editor", ",", "viewer,editor,owner"},
{"no_seperator", "viewer,editor", "owner", "", "viewer,editorowner"},
{"space_seperator", "viewer,editor", "owner", " ", "viewer,editor owner"},
{"diff_seperator", "viewer,editor", "owner", ":", "viewer,editor:owner"},
{"no_separator", "viewer,editor", "owner", "", "viewer,editorowner"},
{"space_separator", "viewer,editor", "owner", " ", "viewer,editor owner"},
{"diff_separator", "viewer,editor", "owner", ":", "viewer,editor:owner"},
{"no_from_str", "", "owner", ",", "owner"},
{"no_append_str", "viewer,editor", "", ",", "viewer,editor"},
}
Expand All @@ -58,9 +58,9 @@ func TestRemoveFromString(t *testing.T) {
}{
{"success", "viewer,editor,owner", "owner", ",", "viewer,editor"},
{"no_exist_success", "viewer", "owner", ",", "viewer"},
{"no_seperator", "viewer,editor,owner", "owner", "", "viewer,editor,owner"},
{"space_seperator", "viewer editor owner", "editor", " ", "viewer owner"},
{"diff_seperator", "viewer,editor,owner", "editor", ":", "viewer,editor,owner"},
{"no_separator", "viewer,editor,owner", "owner", "", "viewer,editor,owner"},
{"space_separator", "viewer editor owner", "editor", " ", "viewer owner"},
{"diff_separator", "viewer,editor,owner", "editor", ":", "viewer,editor,owner"},
{"no_from_str", "", "owner", ",", ""},
{"no_delete_str", "viewer,editor", "", ",", "viewer,editor"},
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/status/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ func UpdateScaledObjectStatus(ctx context.Context, client runtimeclient.StatusCl
return TransformObject(ctx, client, logger, scaledObject, status, transform)
}

// getTriggerAuth returns TriggerAuthentication/ClusterTriggerAuthentication object and its status from ScaledObjectAuthRef or returns an error.
func getTriggerAuth(ctx context.Context, client runtimeclient.Client, triggerAuthRef *kedav1alpha1.ScaledObjectAuthRef, namespace string) (runtimeclient.Object, *kedav1alpha1.TriggerAuthenticationStatus, error) {
// getTriggerAuth returns TriggerAuthentication/ClusterTriggerAuthentication object and its status from AuthenticationRef or returns an error.
func getTriggerAuth(ctx context.Context, client runtimeclient.Client, triggerAuthRef *kedav1alpha1.AuthenticationRef, namespace string) (runtimeclient.Object, *kedav1alpha1.TriggerAuthenticationStatus, error) {
if triggerAuthRef == nil {
return nil, nil, fmt.Errorf("triggerAuthRef is nil")
}
Expand All @@ -89,8 +89,8 @@ func getTriggerAuth(ctx context.Context, client runtimeclient.Client, triggerAut
return nil, nil, fmt.Errorf("unknown trigger auth kind %s", triggerAuthRef.Kind)
}

// updateTriggerAuthenticationStatus patches TriggerAuthentication/ClusterTriggerAuthentication from ScaledObjectAuthRef with the status that updated by statushanler function or returns an error.
func updateTriggerAuthenticationStatus(ctx context.Context, logger logr.Logger, client runtimeclient.Client, namespace string, triggerAuthRef *kedav1alpha1.ScaledObjectAuthRef, statusHandler func(*kedav1alpha1.TriggerAuthenticationStatus) *kedav1alpha1.TriggerAuthenticationStatus) error {
// updateTriggerAuthenticationStatus patches TriggerAuthentication/ClusterTriggerAuthentication from AuthenticationRef with the status that updated by statushanler function or returns an error.
func updateTriggerAuthenticationStatus(ctx context.Context, logger logr.Logger, client runtimeclient.Client, namespace string, triggerAuthRef *kedav1alpha1.AuthenticationRef, statusHandler func(*kedav1alpha1.TriggerAuthenticationStatus) *kedav1alpha1.TriggerAuthenticationStatus) error {
triggerAuth, triggerAuthStatus, err := getTriggerAuth(ctx, client, triggerAuthRef, namespace)

if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion tests/helper/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,7 @@ func generateCA(t *testing.T) {
}
}

// CheckKubectlGetResult runs `kubectl get` with paramters and compares output with expected value
// CheckKubectlGetResult runs `kubectl get` with parameters and compares output with expected value
func CheckKubectlGetResult(t *testing.T, kind string, name string, namespace string, otherparameter string, expected string) {
time.Sleep(1 * time.Second) // wait a second for recource deployment finished
kctlGetCmd := fmt.Sprintf(`kubectl get %s/%s -n %s %s"`, kind, name, namespace, otherparameter)
Expand Down

0 comments on commit 5324709

Please sign in to comment.