From 2c67eb9d7c5df0571e75ade47f40d5c260f8baeb Mon Sep 17 00:00:00 2001 From: Arghya Sadhu Date: Thu, 1 Oct 2020 14:12:30 +0530 Subject: [PATCH] update error message when autoscaling annotation used in service (#1038) --- pkg/kn/commands/service/configuration_edit_flags.go | 2 +- pkg/kn/commands/service/create_mock_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/kn/commands/service/configuration_edit_flags.go b/pkg/kn/commands/service/configuration_edit_flags.go index f3241ba38..ebf31c5f0 100644 --- a/pkg/kn/commands/service/configuration_edit_flags.go +++ b/pkg/kn/commands/service/configuration_edit_flags.go @@ -458,7 +458,7 @@ func (p *ConfigurationEditFlags) Apply( for key, value := range annotationServiceFlagMap { if strings.HasPrefix(key, autoscaling.GroupName) { - return fmt.Errorf("Service cannot have annotation: %s", key) + return fmt.Errorf("service can not have auto-scaling related annotation: %s , please update using '--annotation-revision'", key) } serviceAnnotations[key] = value } diff --git a/pkg/kn/commands/service/create_mock_test.go b/pkg/kn/commands/service/create_mock_test.go index 6e95ac8db..d62a38a56 100644 --- a/pkg/kn/commands/service/create_mock_test.go +++ b/pkg/kn/commands/service/create_mock_test.go @@ -674,7 +674,7 @@ func TestServiceCreateWithAutoScaleServiceAnnotationsError(t *testing.T) { "--annotation-service", autoscaling.InitialScaleAnnotationKey+"=1", "--no-wait", "--revision-name=") assert.Assert(t, err != nil) - assert.Assert(t, util.ContainsAll(output, "Service cannot have annotation: autoscaling.knative.dev/initialScale")) + assert.Assert(t, util.ContainsAll(output, "service can not have auto-scaling related annotation", "autoscaling.knative.dev/initialScale")) r.Validate() }