Merge pull request #5888 from chaosi-zju/pr4447

fix code typo errors
This commit is contained in:
karmada-bot 2024-11-28 11:58:04 +08:00 committed by GitHub
commit 3783eaf0ca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
16 changed files with 23 additions and 23 deletions

View File

@ -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 {

View File

@ -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,
},

View File

@ -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",

View File

@ -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{

View File

@ -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())
}
})
}

View File

@ -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 {

View File

@ -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

View File

@ -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)
}
}

View File

@ -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)
}
}

View File

@ -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),
}
}

View File

@ -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

View File

@ -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 {

View File

@ -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)

View File

@ -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",

View File

@ -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.

View File

@ -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())