From 13c28a00b21cd0afa9f05962ae8c5ad831d3e1f0 Mon Sep 17 00:00:00 2001 From: chaosi-zju Date: Thu, 28 Nov 2024 11:01:54 +0800 Subject: [PATCH] fix code typo errors Signed-off-by: chaosi-zju --- operator/pkg/controlplane/apiserver/apiserver.go | 2 +- operator/pkg/tasks/init/apiserver_test.go | 4 ++-- operator/pkg/tasks/init/cert_test.go | 4 ++-- operator/pkg/util/apiclient/wait_test.go | 2 +- operator/pkg/util/kubeconfig_test.go | 2 +- operator/pkg/util/util_test.go | 2 +- .../certificate/cert_rotation_controller_test.go | 2 +- pkg/controllers/cluster/cluster_controller_test.go | 6 +++--- pkg/registry/cluster/strategy_test.go | 4 ++-- pkg/resourceinterpreter/customized/webhook/customized.go | 2 +- .../argoproj.io/v1alpha1/Workflow/customizations.yaml | 2 +- pkg/search/controllers_test.go | 4 ++-- pkg/util/lifted/taint_test.go | 2 +- pkg/webhook/interpreter/webhook_test.go | 2 +- pkg/webhook/work/mutating_test.go | 4 ++-- test/e2e/framework/resourcebinding.go | 2 +- 16 files changed, 23 insertions(+), 23 deletions(-) diff --git a/operator/pkg/controlplane/apiserver/apiserver.go b/operator/pkg/controlplane/apiserver/apiserver.go index feae902c9..4eb765c7b 100644 --- a/operator/pkg/controlplane/apiserver/apiserver.go +++ b/operator/pkg/controlplane/apiserver/apiserver.go @@ -105,7 +105,7 @@ func createKarmadaAPIServerService(client clientset.Interface, cfg *operatorv1al return fmt.Errorf("error when decoding karmadaApiserver serive: %w", err) } - // merge annotaions with configuration of karmada apiserver. + // merge annotations with configuration of karmada apiserver. karmadaApiserverService.Annotations = labels.Merge(karmadaApiserverService.Annotations, cfg.ServiceAnnotations) if err := apiclient.CreateOrUpdateService(client, karmadaApiserverService); err != nil { diff --git a/operator/pkg/tasks/init/apiserver_test.go b/operator/pkg/tasks/init/apiserver_test.go index 930bb04b2..a057a8c7d 100644 --- a/operator/pkg/tasks/init/apiserver_test.go +++ b/operator/pkg/tasks/init/apiserver_test.go @@ -120,7 +120,7 @@ func TestRunAggregatedAPIServer(t *testing.T) { errMsg: "aggregated-apiserver task invoked with an invalid data struct", }, { - name: "RunAggregatedApiserver_ValidTypeAssertion_TypeAssertionSuceeded", + name: "RunAggregatedApiserver_ValidTypeAssertion_TypeAssertionSucceeded", runData: &TestInitData{}, wantErr: false, }, @@ -156,7 +156,7 @@ func TestRunAPIServer(t *testing.T) { errMsg: "apiserver task invoked with an invalid data struct", }, { - name: "RunAPIServer_ValidTypeAssertion_TypeAssertionSuceeded", + name: "RunAPIServer_ValidTypeAssertion_TypeAssertionSucceeded", runData: &TestInitData{}, wantErr: false, }, diff --git a/operator/pkg/tasks/init/cert_test.go b/operator/pkg/tasks/init/cert_test.go index b66a01707..9e095ce3d 100644 --- a/operator/pkg/tasks/init/cert_test.go +++ b/operator/pkg/tasks/init/cert_test.go @@ -76,7 +76,7 @@ func TestRunCerts(t *testing.T) { errMsg: "certs task invoked with an invalid data struct", }, { - name: "RunCerts_ValidTypeAssertion_TypeAssertionSuceeded", + name: "RunCerts_ValidTypeAssertion_TypeAssertionSucceeded", runData: &TestInitData{}, wantErr: false, }, @@ -119,7 +119,7 @@ func TestSkipCerts(t *testing.T) { errMsg: "certs task invoked with an invalid data struct", }, { - name: "SkipCerts_ValidTypeAssertion_TypeAssertionSuceeded", + name: "SkipCerts_ValidTypeAssertion_TypeAssertionSucceeded", runData: &TestInitData{ Name: "karmada-demo", Namespace: "test", diff --git a/operator/pkg/util/apiclient/wait_test.go b/operator/pkg/util/apiclient/wait_test.go index c1d7a32cf..f8f170950 100644 --- a/operator/pkg/util/apiclient/wait_test.go +++ b/operator/pkg/util/apiclient/wait_test.go @@ -157,7 +157,7 @@ func TestWaitForAPIService(t *testing.T) { prep: func(client aggregator.Interface, apiService *apiregistrationv1.APIService) error { apiServiceCreated, err := client.ApiregistrationV1().APIServices().Create(context.TODO(), apiService, metav1.CreateOptions{}) if err != nil { - return fmt.Errorf("faield to create api service %s, got err: %v", apiService.Name, err) + return fmt.Errorf("failed to create api service %s, got err: %v", apiService.Name, err) } apiServiceCreated.Status = apiregistrationv1.APIServiceStatus{ Conditions: []apiregistrationv1.APIServiceCondition{ diff --git a/operator/pkg/util/kubeconfig_test.go b/operator/pkg/util/kubeconfig_test.go index d2f914c6a..3fd4d05b0 100644 --- a/operator/pkg/util/kubeconfig_test.go +++ b/operator/pkg/util/kubeconfig_test.go @@ -158,7 +158,7 @@ users: t.Errorf("unexpected error, got: %v", err) } if err != nil && test.wantErr && !strings.Contains(err.Error(), test.errMsg) { - t.Errorf("expceted error message %s to be in %s", test.errMsg, err.Error()) + t.Errorf("expected error message %s to be in %s", test.errMsg, err.Error()) } }) } diff --git a/operator/pkg/util/util_test.go b/operator/pkg/util/util_test.go index 9edc46e02..a9fe592cc 100644 --- a/operator/pkg/util/util_test.go +++ b/operator/pkg/util/util_test.go @@ -177,7 +177,7 @@ func TestDownloadFile(t *testing.T) { errMsg: "failed to download file", }, { - name: "DownloadFile_FileDownlaoded_", + name: "DownloadFile_FileDownloaded_", url: "https://www.example.com/test-file", filePath: filepath.Join(os.TempDir(), "temp-download-file.txt"), prep: func(_, filePath string) error { diff --git a/pkg/controllers/certificate/cert_rotation_controller_test.go b/pkg/controllers/certificate/cert_rotation_controller_test.go index 9033eb541..b16516239 100644 --- a/pkg/controllers/certificate/cert_rotation_controller_test.go +++ b/pkg/controllers/certificate/cert_rotation_controller_test.go @@ -165,7 +165,7 @@ func TestCertRotationController_syncCertRotation(t *testing.T) { wantErr bool }{ { - name: "shoud not rotate cert", + name: "should not rotate cert", secret: &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{Namespace: "ns1", Name: "secret"}, Data: map[string][]byte{"karmada-kubeconfig": []byte(`apiVersion: v1 diff --git a/pkg/controllers/cluster/cluster_controller_test.go b/pkg/controllers/cluster/cluster_controller_test.go index 000725e9f..cbdcef296 100644 --- a/pkg/controllers/cluster/cluster_controller_test.go +++ b/pkg/controllers/cluster/cluster_controller_test.go @@ -287,19 +287,19 @@ func TestController_Reconcile(t *testing.T) { c := newClusterController() if tt.cluster != nil { if err := c.Create(context.Background(), tt.cluster, &client.CreateOptions{}); err != nil { - t.Fatalf("faild to create cluster %v", err) + t.Fatalf("failed to create cluster %v", err) } } if tt.ns != nil { if err := c.Create(context.Background(), tt.ns, &client.CreateOptions{}); err != nil { - t.Fatalf("faild to create ns %v", err) + t.Fatalf("failed to create ns %v", err) } } if tt.work != nil { if err := c.Create(context.Background(), tt.work, &client.CreateOptions{}); err != nil { - t.Fatalf("faild to create work %v", err) + t.Fatalf("failed to create work %v", err) } } diff --git a/pkg/registry/cluster/strategy_test.go b/pkg/registry/cluster/strategy_test.go index 80a2c4f41..a3a1dfb49 100644 --- a/pkg/registry/cluster/strategy_test.go +++ b/pkg/registry/cluster/strategy_test.go @@ -304,7 +304,7 @@ func TestStrategy_WarningsOnCreate(t *testing.T) { wrs := clusterStrategy.WarningsOnCreate(ctx, cluster) if len(wrs) > 0 { - t.Errorf("Cluster is validate but go warings: %v", wrs) + t.Errorf("Cluster is validate but go warnings: %v", wrs) } } @@ -372,6 +372,6 @@ func TestStrategy_WarningsOnUpdate(t *testing.T) { wrs := clusterStrategy.WarningsOnUpdate(ctx, cluster, nil) if len(wrs) > 0 { - t.Errorf("Cluster is validate but go warings: %v", wrs) + t.Errorf("Cluster is validate but go warnings: %v", wrs) } } diff --git a/pkg/resourceinterpreter/customized/webhook/customized.go b/pkg/resourceinterpreter/customized/webhook/customized.go index efa8e7cd1..bd4866cd1 100644 --- a/pkg/resourceinterpreter/customized/webhook/customized.go +++ b/pkg/resourceinterpreter/customized/webhook/customized.go @@ -263,7 +263,7 @@ func (e *CustomizedInterpreter) callHook(ctx context.Context, hook configmanager if err != nil { return nil, &webhookutil.ErrCallingWebhook{ WebhookName: hook.GetUID(), - Reason: fmt.Errorf("reveived invalid webhook response: %w", err), + Reason: fmt.Errorf("received invalid webhook response: %w", err), } } diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/argoproj.io/v1alpha1/Workflow/customizations.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/argoproj.io/v1alpha1/Workflow/customizations.yaml index 5e6413516..0215d5af2 100644 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/argoproj.io/v1alpha1/Workflow/customizations.yaml +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/argoproj.io/v1alpha1/Workflow/customizations.yaml @@ -74,7 +74,7 @@ spec: if desiredObj.spec.volumes ~= nil then volumes = desiredObj.spec.volumes end - for volumnIndex, volume in pairs(volumes) do + for volumeIndex, volume in pairs(volumes) do if volume.configMap ~= nil and volume.configMap.name ~= nil and volume.configMap.name ~= '' then dependentConfigMaps[volume.configMap.name] = true end diff --git a/pkg/search/controllers_test.go b/pkg/search/controllers_test.go index 7b0f1f5c6..30cfbc45c 100644 --- a/pkg/search/controllers_test.go +++ b/pkg/search/controllers_test.go @@ -194,7 +194,7 @@ func TestUpdateClusterEventHandler(t *testing.T) { }, verify: func(clientConnector *fakekarmadaclient.Clientset, controller *Controller) error { var ( - clusterName, resourceVersion, updatedResourceVerison = "test-cluster", "1000", "1001" + clusterName, resourceVersion, updatedResourceVersion = "test-cluster", "1000", "1001" apiEndpoint, oldLabels, newLabels = "10.0.0.1", map[string]string{"status": "old"}, map[string]string{"status": "new"} ) @@ -205,7 +205,7 @@ func TestUpdateClusterEventHandler(t *testing.T) { return err } - if err := upsertCluster(clientConnector, newLabels, apiEndpoint, clusterName, updatedResourceVerison); err != nil { + if err := upsertCluster(clientConnector, newLabels, apiEndpoint, clusterName, updatedResourceVersion); err != nil { return err } if err := cacheNextWrapper(controller); err != nil { diff --git a/pkg/util/lifted/taint_test.go b/pkg/util/lifted/taint_test.go index baea6d71c..4f0fadd4e 100644 --- a/pkg/util/lifted/taint_test.go +++ b/pkg/util/lifted/taint_test.go @@ -184,7 +184,7 @@ func TestParseTaints(t *testing.T) { t.Errorf("[%s] expected no error for spec %s, but got: %v", c.name, c.spec, err) } if !reflect.DeepEqual(c.expectedTaints, taints) { - t.Errorf("[%s] expected returen taints as %v, but got: %v", c.name, c.expectedTaints, taints) + t.Errorf("[%s] expected return taints as %v, but got: %v", c.name, c.expectedTaints, taints) } if !reflect.DeepEqual(c.expectedTaintsToRemove, taintsToRemove) { t.Errorf("[%s] expected return taints to be removed as %v, but got: %v", c.name, c.expectedTaintsToRemove, taintsToRemove) diff --git a/pkg/webhook/interpreter/webhook_test.go b/pkg/webhook/interpreter/webhook_test.go index 5b5e7e671..4fde9ee54 100644 --- a/pkg/webhook/interpreter/webhook_test.go +++ b/pkg/webhook/interpreter/webhook_test.go @@ -105,7 +105,7 @@ func TestComplete(t *testing.T) { verify: verifyResourceInterpreterCompleteResponse, }, { - name: "TestComplete_OverrideResponseUIDAndStatusCode_ResponseUIDAndStatusCodeAreOverrided", + name: "TestComplete_OverrideResponseUIDAndStatusCode_ResponseUIDAndStatusCodeAreOverridden", req: Request{ ResourceInterpreterRequest: configv1alpha1.ResourceInterpreterRequest{ UID: "test-uid", diff --git a/pkg/webhook/work/mutating_test.go b/pkg/webhook/work/mutating_test.go index 5b3e7e895..c28673de2 100644 --- a/pkg/webhook/work/mutating_test.go +++ b/pkg/webhook/work/mutating_test.go @@ -33,7 +33,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" - schema "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/runtime/schema" "sigs.k8s.io/controller-runtime/pkg/webhook/admission" workv1alpha1 "github.com/karmada-io/karmada/pkg/apis/work/v1alpha1" @@ -268,7 +268,7 @@ func TestMutatingAdmission_Handle_FullCoverage(t *testing.T) { // Unmarshal JSON into unstructured object. if err = json.Unmarshal(wantDeploymentJSON, wantDeploymentUnstructured); err != nil { - t.Errorf("Error unmarshaling to unstructured: %v", err) + t.Errorf("Error unmarshalling to unstructured: %v", err) } // Remove the status and creationTimestamp fields to simulate what happen after mutations. diff --git a/test/e2e/framework/resourcebinding.go b/test/e2e/framework/resourcebinding.go index eb12b70cc..de2d6386f 100644 --- a/test/e2e/framework/resourcebinding.go +++ b/test/e2e/framework/resourcebinding.go @@ -74,7 +74,7 @@ func WaitGracefulEvictionTasksDone(client karmada.Interface, namespace, name str return err } if len(binding.Spec.GracefulEvictionTasks) > 0 { - return fmt.Errorf("%d GracefulEvictionTasks is being precessing", len(binding.Spec.GracefulEvictionTasks)) + return fmt.Errorf("%d GracefulEvictionTasks is being processing", len(binding.Spec.GracefulEvictionTasks)) } return nil }, pollTimeout, pollInterval).ShouldNot(gomega.HaveOccurred())