Skip to content

Commit d8b31cb

Browse files
gongna-auapecloud-bot
authored andcommitted
fix: correct typos and grammar errors in error messages and comments (#10154)
(cherry picked from commit bc19801)
1 parent 8e7ab36 commit d8b31cb

9 files changed

Lines changed: 20 additions & 20 deletions

File tree

pkg/common/openapiv3schema.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ func ValidateDataWithSchema(openAPIV3Schema *apiextensionsv1.JSONSchemaProps, da
5757
func ConvertStringToInterfaceBySchemaType(openAPIV3Schema *apiextensionsv1.JSONSchemaProps, input map[string]string) (map[string]interface{}, error) {
5858
out := map[string]interface{}{}
5959
properties := openAPIV3Schema.Properties
60-
covertError := func(key string, err error) error {
61-
return fmt.Errorf(`covert "%s" failed: %s`, key, err.Error())
60+
convertError := func(key string, err error) error {
61+
return fmt.Errorf(`convert "%s" failed: %s`, key, err.Error())
6262
}
6363
var err error
6464
for k, v := range input {
@@ -80,7 +80,7 @@ func ConvertStringToInterfaceBySchemaType(openAPIV3Schema *apiextensionsv1.JSONS
8080
out[k] = v
8181
}
8282
if err != nil {
83-
return nil, covertError(k, err)
83+
return nil, convertError(k, err)
8484
}
8585
}
8686
return out, nil

pkg/controller/component/available.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -501,15 +501,15 @@ func (h *AvailableEventHandler) evalActionEvent(assertion appsv1.ActionAssertion
501501
}
502502
if assertion.Stdout != nil {
503503
if assertion.Stdout.EqualTo != nil && !bytes.Equal(event.Stdout, []byte(*assertion.Stdout.EqualTo)) {
504-
return false, fmt.Sprintf("probe stdout is not match: %s", prefix16(*assertion.Stdout.EqualTo))
504+
return false, fmt.Sprintf("probe stdout does not match: %s", prefix16(*assertion.Stdout.EqualTo))
505505
}
506506
if assertion.Stdout.Contains != nil && !bytes.Contains(event.Stdout, []byte(*assertion.Stdout.Contains)) {
507507
return false, fmt.Sprintf("probe stdout does not contain: %s", prefix16(*assertion.Stdout.Contains))
508508
}
509509
}
510510
if assertion.Stderr != nil {
511511
if assertion.Stderr.EqualTo != nil && !bytes.Equal(event.Stderr, []byte(*assertion.Stderr.EqualTo)) {
512-
return false, fmt.Sprintf("probe stderr is not match: %s", prefix16(*assertion.Stderr.EqualTo))
512+
return false, fmt.Sprintf("probe stderr does not match: %s", prefix16(*assertion.Stderr.EqualTo))
513513
}
514514
if assertion.Stderr.Contains != nil && !bytes.Contains(event.Stderr, []byte(*assertion.Stderr.Contains)) {
515515
return false, fmt.Sprintf("probe stderr does not contain: %s", prefix16(*assertion.Stderr.Contains))

pkg/controller/component/service_reference.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ func handleServiceRefFromServiceDescriptor(ctx context.Context, cli client.Reade
295295

296296
match := verifyServiceKindAndVersion(*serviceDescriptor, serviceRefDecl.ServiceRefDeclarationSpecs...)
297297
if !match {
298-
return nil, fmt.Errorf("service descriptor %s kind or version is not match with service reference declaration %s", serviceDescriptor.Name, serviceRefDecl.Name)
298+
return nil, fmt.Errorf("service descriptor %s kind or version does not match service reference declaration %s", serviceDescriptor.Name, serviceRefDecl.Name)
299299
}
300300
return serviceDescriptor, nil
301301
}

pkg/controller/instancetemplate/validation.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import (
2727
func ValidateInstanceTemplates(its *workloads.InstanceSet, tree *kubebuilderx.ObjectTree) error {
2828
instancesCompressed, err := findTemplateObject(its, tree)
2929
if err != nil {
30-
return fmt.Errorf("failed to find compreesssed template: %w", err)
30+
return fmt.Errorf("failed to find compressed template: %w", err)
3131
}
3232

3333
instanceTemplates := getInstanceTemplates(its.Spec.Instances, instancesCompressed)
@@ -45,9 +45,9 @@ func ValidateInstanceTemplates(its *workloads.InstanceSet, tree *kubebuilderx.Ob
4545
}
4646
templateNames.Insert(template.Name)
4747
}
48-
// sum of spec.templates[*].replicas should not greater than spec.replicas
48+
// sum of spec.templates[*].replicas should not be greater than spec.replicas
4949
if replicasInTemplates > *its.Spec.Replicas {
50-
err = fmt.Errorf("total replicas in instances(%d) should not greater than replicas in spec(%d)", replicasInTemplates, *its.Spec.Replicas)
50+
err = fmt.Errorf("total replicas in instances(%d) should not be greater than replicas in spec(%d)", replicasInTemplates, *its.Spec.Replicas)
5151
return err
5252
}
5353

pkg/controller/instancetemplate/validation_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ var _ = Describe("Validation", func() {
9797
tree := &kubebuilderx.ObjectTree{}
9898
err := ValidateInstanceTemplates(its, tree)
9999
Expect(err).To(HaveOccurred())
100-
Expect(err.Error()).To(ContainSubstring("total replicas in instances(4) should not greater than replicas in spec(3)"))
100+
Expect(err.Error()).To(ContainSubstring("total replicas in instances(4) should not be greater than replicas in spec(3)"))
101101
})
102102

103103
It("should fail validation when total replicas restricted by ordinals do not equal to spec.replicas", func() {
@@ -139,7 +139,7 @@ var _ = Describe("Validation", func() {
139139
tree := &kubebuilderx.ObjectTree{}
140140
err := ValidateInstanceTemplates(its, tree)
141141
Expect(err).To(HaveOccurred())
142-
Expect(err.Error()).To(ContainSubstring("total replicas in instances(4) should not greater than replicas in spec(3)"))
142+
Expect(err.Error()).To(ContainSubstring("total replicas in instances(4) should not be greater than replicas in spec(3)"))
143143
})
144144
})
145145
})

pkg/controller/lifecycle/errors.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import (
2626
var (
2727
ErrActionNotDefined = errors.New("action is not defined")
2828
ErrActionNotImplemented = errors.New("action is not implemented")
29-
ErrPreconditionFailed = errors.New("action precondition is not matched")
29+
ErrPreconditionFailed = errors.New("action precondition is not met")
3030
ErrActionInProgress = errors.New("action is in progress")
3131
ErrActionBusy = errors.New("action is busy")
3232
ErrActionTimedOut = errors.New("action timed-out")

pkg/controller/lifecycle/lifecycle_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ var _ = Describe("lifecycle", func() {
483483

484484
err = lifecycle.PostProvision(ctx, reader, nil)
485485
Expect(err).ShouldNot(BeNil())
486-
Expect(err.Error()).Should(ContainSubstring("action precondition is not matched"))
486+
Expect(err.Error()).Should(ContainSubstring("action precondition is not met"))
487487
})
488488

489489
It("precondition - object selector", func() {
@@ -576,7 +576,7 @@ var _ = Describe("lifecycle", func() {
576576
PreConditionObjectSelector: labels,
577577
}, "custom-action", customAction, nil)
578578
Expect(err).ShouldNot(BeNil())
579-
Expect(err.Error()).Should(ContainSubstring("action precondition is not matched"))
579+
Expect(err.Error()).Should(ContainSubstring("action precondition is not met"))
580580
})
581581

582582
It("pod selector - any", func() {

pkg/operations/custom.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,11 @@ func (c CustomOpsHandler) checkExpression(reqCtx intctrlutil.RequestCtx,
155155
return err
156156
}
157157
for _, comp := range comps {
158-
params, err := covertParametersToMap(reqCtx.Ctx, cli, compCustomItem.Parameters, opsRes.OpsRequest.Namespace)
158+
params, err := convertParametersToMap(reqCtx.Ctx, cli, compCustomItem.Parameters, opsRes.OpsRequest.Namespace)
159159
if err != nil {
160160
return err
161161
}
162-
// get the built-in objects and covert the json tag
162+
// get the built-in objects and convert the json tag
163163
getBuiltInObjs := func() (map[string]interface{}, error) {
164164
b, err := json.Marshal(map[string]interface{}{
165165
"cluster": opsRes.Cluster,
@@ -236,7 +236,7 @@ func (c CustomOpsHandler) initCompActionStatusAndPreCheck(reqCtx intctrlutil.Req
236236
return 0, true
237237
}
238238

239-
func covertParametersToMap(ctx context.Context,
239+
func convertParametersToMap(ctx context.Context,
240240
cli client.Client,
241241
parameters []opsv1alpha1.Parameter,
242242
opsNamespace string) (map[string]string, error) {
@@ -326,11 +326,11 @@ func initOpsDefAndValidate(reqCtx intctrlutil.RequestCtx,
326326
for _, v := range customSpec.CustomOpsComponents {
327327
// 1. validate OpenApV3Schema
328328
if parametersSchema != nil {
329-
paramsMap, err := covertParametersToMap(reqCtx.Ctx, cli, v.Parameters, opsRes.OpsRequest.Namespace)
329+
paramsMap, err := convertParametersToMap(reqCtx.Ctx, cli, v.Parameters, opsRes.OpsRequest.Namespace)
330330
if err != nil {
331331
return err
332332
}
333-
// covert to type map[string]interface{}
333+
// convert to type map[string]interface{}
334334
params, err := common.ConvertStringToInterfaceBySchemaType(parametersSchema.OpenAPIV3Schema, paramsMap)
335335
if err != nil {
336336
return intctrlutil.NewFatalError(err.Error())

pkg/operations/horizontal_scaling.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ func (hs horizontalScalingOpsHandler) Action(reqCtx intctrlutil.RequestCtx, cli
133133
insReplicas += v.GetReplicas()
134134
}
135135
if insReplicas > replicas {
136-
errMsg := fmt.Sprintf(`the total number of replicas for the instance template can not greater than the number of replicas for component "%s" after horizontally scaling`,
136+
errMsg := fmt.Sprintf(`the total number of replicas for the instance template cannot be greater than the number of replicas for component "%s" after horizontally scaling`,
137137
horizontalScaling.ComponentName)
138138
return intctrlutil.NewFatalError(errMsg)
139139
}

0 commit comments

Comments
 (0)