Repository: knative/client
Pull request #958 (2020-07-28 14:24:37)

Deprecates --max-scale/--min-scale for more consistent naming
## Description

This PR updates --max-scale and --min-scale to --scale-max and --scale-min

## Changes

* Updated --max-scale to --scale-max
* Updated --min-scale to --scale-min

## Reference

https://github.com/knative/client/issues/822


knative-prow-robot: [APPROVALNOTIFIER] This PR is **NOT APPROVED**

This pull-request has been approved by: *<a href="https://github.com/knative/client/pull/958#" title="Author self-approved">mpetason</a>*
To complete the [pull request process](https://git.k8s.io/community/contributors/guide/owners.md#the-code-review-process), please assign **navidshaikh**
You can assign the PR to them by writing `/assign @navidshaikh` in a comment when ready.

The full list of commands accepted by this bot can be found [here](https://go.k8s.io/bot-commands?repo=knative%2Fclient).

<details open>
Needs approval from an approver in each of these files:

- **[OWNERS](https://github.com/knative/client/blob/master/OWNERS)**

Approvers can indicate their approval by writing `/approve` in a comment
Approvers can cancel approval by writing `/approve cancel` in a comment
</details>
<!-- META={"approvers":["navidshaikh"]} -->
mpetason: This may require additional work. I wasn't sure if I should be changing some of the function names and others to match the renaming. 
knative-prow-robot: [APPROVALNOTIFIER] This PR is **NOT APPROVED**

This pull-request has been approved by: *<a href="https://github.com/knative/client/pull/958#pullrequestreview-456745914" title="Approved">daisy-ycguo</a>*, *<a href="https://github.com/knative/client/pull/958#" title="Author self-approved">mpetason</a>*
To complete the [pull request process](https://git.k8s.io/community/contributors/guide/owners.md#the-code-review-process), please assign **navidshaikh**
You can assign the PR to them by writing `/assign @navidshaikh` in a comment when ready.

The full list of commands accepted by this bot can be found [here](https://go.k8s.io/bot-commands?repo=knative%2Fclient).

<details open>
Needs approval from an approver in each of these files:

- **[OWNERS](https://github.com/knative/client/blob/master/OWNERS)**

Approvers can indicate their approval by writing `/approve` in a comment
Approvers can cancel approval by writing `/approve cancel` in a comment
</details>
<!-- META={"approvers":["navidshaikh"]} -->

Patch:
diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc
index 1c681980..b0c1ed2f 100644
--- a/CHANGELOG.adoc
+++ b/CHANGELOG.adoc
@@ -18,6 +18,10 @@
 |===
 | | Description | PR
 
+| 🐣
+| Allow the kn test image to be customized via environment variable
+| https://github.com/knative/client/pull/957[#957]
+
 | 🎁
 | Add support to combine service create --filename with other options
 | https://github.com/knative/client/pull/937[#937]
diff --git a/docs/cmd/kn_service_create.md b/docs/cmd/kn_service_create.md
index b07a3410..ec259eda 100644
--- a/docs/cmd/kn_service_create.md
+++ b/docs/cmd/kn_service_create.md
@@ -75,8 +75,6 @@ kn service create NAME --image IMAGE
       --limits-cpu string             DEPRECATED: please use --limit instead. The limits on the requested CPU (e.g., 1000m).
       --limits-memory string          DEPRECATED: please use --limit instead. The limits on the requested memory (e.g., 1024Mi).
       --lock-to-digest                Keep the running image for the service constant when not explicitly specifying the image. (--no-lock-to-digest pulls the image tag afresh with each new revision) (default true)
-      --max-scale int                 Maximal number of replicas.
-      --min-scale int                 Minimal number of replicas.
       --mount stringArray             Mount a ConfigMap (prefix cm: or config-map:), a Secret (prefix secret: or sc:), or an existing Volume (without any prefix) on the specified directory. Example: --mount /mydir=cm:myconfigmap, --mount /mydir=secret:mysecret, or --mount /mydir=myvolume. When a configmap or a secret is specified, a corresponding volume is automatically generated. You can use this flag multiple times. For unmounting a directory, append "-", e.g. --mount /mydir-, which also removes any auto-generated volume.
   -n, --namespace string              Specify the namespace to operate in.
       --no-cluster-local              Do not specify that the service be private. (--no-cluster-local will make the service publicly available) (default true)
@@ -89,6 +87,8 @@ kn service create NAME --image IMAGE
       --requests-memory string        DEPRECATED: please use --request instead. The requested memory (e.g., 64Mi).
       --revision-name string          The revision name to set. Must start with the service name and a dash as a prefix. Empty revision name will result in the server generating a name for the revision. Accepts golang templates, allowing {{.Service}} for the service name, {{.Generation}} for the generation, and {{.Random [n]}} for n random consonants. (default "{{.Service}}-{{.Random 5}}-{{.Generation}}")
       --scale int                     Minimum and maximum number of replicas.
+      --scale-max int                 Maximum number of replicas.
+      --scale-min int                 Minimum number of replicas.
       --service-account string        Service account name to set. An empty argument ("") clears the service account. The referenced service account must exist in the service's namespace.
       --user int                      The user ID to run the container (e.g., 1001).
       --volume stringArray            Add a volume from a ConfigMap (prefix cm: or config-map:) or a Secret (prefix secret: or sc:). Example: --volume myvolume=cm:myconfigmap or --volume myvolume=secret:mysecret. You can use this flag multiple times. To unset a ConfigMap/Secret reference, append "-" to the name, e.g. --volume myvolume-.
diff --git a/docs/cmd/kn_service_update.md b/docs/cmd/kn_service_update.md
index f8a1dd64..b4b30654 100644
--- a/docs/cmd/kn_service_update.md
+++ b/docs/cmd/kn_service_update.md
@@ -58,8 +58,6 @@ kn service update NAME
       --limits-cpu string             DEPRECATED: please use --limit instead. The limits on the requested CPU (e.g., 1000m).
       --limits-memory string          DEPRECATED: please use --limit instead. The limits on the requested memory (e.g., 1024Mi).
       --lock-to-digest                Keep the running image for the service constant when not explicitly specifying the image. (--no-lock-to-digest pulls the image tag afresh with each new revision) (default true)
-      --max-scale int                 Maximal number of replicas.
-      --min-scale int                 Minimal number of replicas.
       --mount stringArray             Mount a ConfigMap (prefix cm: or config-map:), a Secret (prefix secret: or sc:), or an existing Volume (without any prefix) on the specified directory. Example: --mount /mydir=cm:myconfigmap, --mount /mydir=secret:mysecret, or --mount /mydir=myvolume. When a configmap or a secret is specified, a corresponding volume is automatically generated. You can use this flag multiple times. For unmounting a directory, append "-", e.g. --mount /mydir-, which also removes any auto-generated volume.
   -n, --namespace string              Specify the namespace to operate in.
       --no-cluster-local              Do not specify that the service be private. (--no-cluster-local will make the service publicly available) (default true)
@@ -72,6 +70,8 @@ kn service update NAME
       --requests-memory string        DEPRECATED: please use --request instead. The requested memory (e.g., 64Mi).
       --revision-name string          The revision name to set. Must start with the service name and a dash as a prefix. Empty revision name will result in the server generating a name for the revision. Accepts golang templates, allowing {{.Service}} for the service name, {{.Generation}} for the generation, and {{.Random [n]}} for n random consonants. (default "{{.Service}}-{{.Random 5}}-{{.Generation}}")
       --scale int                     Minimum and maximum number of replicas.
+      --scale-max int                 Maximum number of replicas.
+      --scale-min int                 Minimum number of replicas.
       --service-account string        Service account name to set. An empty argument ("") clears the service account. The referenced service account must exist in the service's namespace.
       --tag strings                   Set tag (format: --tag revisionRef=tagName) where revisionRef can be a revision or '@latest' string representing latest ready revision. This flag can be specified multiple times.
       --traffic strings               Set traffic distribution (format: --traffic revisionRef=percent) where revisionRef can be a revision or a tag or '@latest' string representing latest ready revision. This flag can be given multiple times with percent summing up to 100%.
diff --git a/docs/operations/autoscaling.md b/docs/operations/autoscaling.md
index 35d1e4d5..6329e004 100644
--- a/docs/operations/autoscaling.md
+++ b/docs/operations/autoscaling.md
@@ -20,5 +20,5 @@ flags to configure the autoscaling behavior.
 | :------------------------- | :-------------------------------------------------------------------------------------------------------------------------- |
 | `--concurrency-limit int`  | Hard limit of concurrent requests to be processed by a single replica.                                                      |
 | `--concurrency-target int` | Recommendation for when to scale up based on the concurrent number of incoming requests. Defaults to `--concurrency-limit`. |
-| `--max-scale int`          | Maximum number of replicas.                                                                                                 |
-| `--min-scale int`          | Minimum number of replicas.                                                                                                 |
+| `--scale-max int`          | Maximum number of replicas.                                                                                                 |
+| `--scale-min int`          | Minimum number of replicas.                                                                                                 |
diff --git a/pkg/kn/commands/service/configuration_edit_flags.go b/pkg/kn/commands/service/configuration_edit_flags.go
index 1cffcaf3..aa1e7e79 100644
--- a/pkg/kn/commands/service/configuration_edit_flags.go
+++ b/pkg/kn/commands/service/configuration_edit_flags.go
@@ -183,14 +183,22 @@ func (p *ConfigurationEditFlags) addSharedFlags(command *cobra.Command) {
 	p.markFlagMakesRevision("limits-memory")
 
 	command.Flags().IntVar(&p.MinScale, "min-scale", 0, "Minimal number of replicas.")
+	command.Flags().MarkHidden("min-scale")
 	p.markFlagMakesRevision("min-scale")
 
 	command.Flags().IntVar(&p.MaxScale, "max-scale", 0, "Maximal number of replicas.")
+	command.Flags().MarkHidden("max-scale")
 	p.markFlagMakesRevision("max-scale")
 
 	command.Flags().IntVar(&p.Scale, "scale", 0, "Minimum and maximum number of replicas.")
 	p.markFlagMakesRevision("scale")
 
+	command.Flags().IntVar(&p.MinScale, "scale-min", 0, "Minimum number of replicas.")
+	p.markFlagMakesRevision("scale-min")
+
+	command.Flags().IntVar(&p.MaxScale, "scale-max", 0, "Maximum number of replicas.")
+	p.markFlagMakesRevision("scale-max")
+
 	command.Flags().StringVar(&p.AutoscaleWindow, "autoscale-window", "", "Duration to look back for making auto-scaling decisions. The service is scaled to zero if no request was received in during that time. (eg: 10s)")
 	p.markFlagMakesRevision("autoscale-window")
 
@@ -430,14 +438,14 @@ func (p *ConfigurationEditFlags) Apply(
 		}
 	}
 
-	if cmd.Flags().Changed("min-scale") {
+	if cmd.Flags().Changed("scale-min") {
 		err = servinglib.UpdateMinScale(template, p.MinScale)
 		if err != nil {
 			return err
 		}
 	}
 
-	if cmd.Flags().Changed("max-scale") {
+	if cmd.Flags().Changed("scale-max") {
 		err = servinglib.UpdateMaxScale(template, p.MaxScale)
 		if err != nil {
 			return err
@@ -445,10 +453,10 @@ func (p *ConfigurationEditFlags) Apply(
 	}
 
 	if cmd.Flags().Changed("scale") {
-		if cmd.Flags().Changed("max-scale") {
-			return fmt.Errorf("only --scale or --max-scale can be specified")
-		} else if cmd.Flags().Changed("min-scale") {
-			return fmt.Errorf("only --scale or --min-scale can be specified")
+		if cmd.Flags().Changed("scale-max") {
+			return fmt.Errorf("only --scale or --scale-max can be specified")
+		} else if cmd.Flags().Changed("scale-min") {
+			return fmt.Errorf("only --scale or --scale-min can be specified")
 		} else {
 			err = servinglib.UpdateMaxScale(template, p.Scale)
 			if err != nil {


Test patch:
diff --git a/cmd/kn/main_test.go b/cmd/kn/main_test.go
index 7de84c24..4c642646 100644
--- a/cmd/kn/main_test.go
+++ b/cmd/kn/main_test.go
@@ -142,7 +142,7 @@ func TestUnknownCommands(t *testing.T) {
 		expectedError []string
 	}{
 		{
-			[]string{"service", "udpate", "test", "--min-scale=0"},
+			[]string{"service", "udpate", "test", "--scale-min=0"},
 			[]string{"service"},
 			[]string{"unknown sub-command", "udpate"},
 		},
diff --git a/lib/test/integration.go b/lib/test/integration.go
index 421920de..3482b876 100644
--- a/lib/test/integration.go
+++ b/lib/test/integration.go
@@ -29,6 +29,7 @@ const (
 	KnDefaultTestImage string        = "gcr.io/knative-samples/helloworld-go"
 	MaxRetries         int           = 10
 	RetrySleepDuration time.Duration = 5 * time.Second
+	KnTestImageEnv     string        = "KN_TEST_IMAGE" // Allow test image to be customized
 )
 
 var nsMutex sync.Mutex
@@ -42,6 +43,15 @@ type KnTest struct {
 	kn        Kn
 }
 
+// GetKnTestImage returns either customized or default kn test image
+func GetKnTestImage() string {
+	value := os.Getenv(KnTestImageEnv)
+	if value == "" {
+		return KnDefaultTestImage
+	}
+	return value
+}
+
 // NewKnTest creates a new KnTest object
 func NewKnTest() (*KnTest, error) {
 	ns := ""
diff --git a/lib/test/service.go b/lib/test/service.go
index 69f8613b..a5173a94 100644
--- a/lib/test/service.go
+++ b/lib/test/service.go
@@ -28,7 +28,7 @@ import (
 
 // ServiceCreate verifies given service creation in sync mode and also verifies output
 func ServiceCreate(r *KnRunResultCollector, serviceName string) {
-	out := r.KnTest().Kn().Run("service", "create", serviceName, "--image", KnDefaultTestImage)
+	out := r.KnTest().Kn().Run("service", "create", serviceName, "--image", GetKnTestImage())
 	r.AssertNoError(out)
 	assert.Check(r.T(), util.ContainsAllIgnoreCase(out.Stdout, "service", serviceName, "creating", "namespace", r.KnTest().Kn().Namespace(), "ready"))
 }
@@ -51,7 +51,7 @@ func ServiceList(r *KnRunResultCollector, serviceName string) {
 func ServiceDescribe(r *KnRunResultCollector, serviceName string) {
 	out := r.KnTest().Kn().Run("service", "describe", serviceName)
 	r.AssertNoError(out)
-	assert.Assert(r.T(), util.ContainsAll(out.Stdout, serviceName, r.KnTest().Kn().Namespace(), KnDefaultTestImage))
+	assert.Assert(r.T(), util.ContainsAll(out.Stdout, serviceName, r.KnTest().Kn().Namespace(), GetKnTestImage()))
 	assert.Assert(r.T(), util.ContainsAll(out.Stdout, "Conditions", "ConfigurationsReady", "Ready", "RoutesReady"))
 	assert.Assert(r.T(), util.ContainsAll(out.Stdout, "Name", "Namespace", "URL", "Age", "Revisions"))
 }
diff --git a/pkg/kn/commands/service/create_test.go b/pkg/kn/commands/service/create_test.go
index 12746bca..663fcde9 100644
--- a/pkg/kn/commands/service/create_test.go
+++ b/pkg/kn/commands/service/create_test.go
@@ -513,7 +513,7 @@ func TestServiceCreateRequestsLimitsMemory(t *testing.T) {
 func TestServiceCreateMaxMinScale(t *testing.T) {
 	action, created, _, err := fakeServiceCreate([]string{
 		"service", "create", "foo", "--image", "gcr.io/foo/bar:baz",
-		"--min-scale", "1", "--max-scale", "5",
+		"--scale-min", "1", "--scale-max", "5",
 		"--concurrency-target", "10", "--concurrency-limit", "100",
 		"--concurrency-utilization", "50",
 		"--no-wait"}, false)
@@ -592,11 +592,11 @@ func TestServiceCreateScaleWithNegativeValue(t *testing.T) {
 func TestServiceCreateScaleWithMaxScaleSet(t *testing.T) {
 	_, _, _, err := fakeServiceCreate([]string{
 		"service", "create", "foo", "--image", "gcr.io/foo/bar:baz",
-		"--scale", "5", "--max-scale", "2", "--no-wait"}, true)
+		"--scale", "5", "--scale-max", "2", "--no-wait"}, true)
 	if err == nil {
 		t.Fatal(err)
 	}
-	expectedErrMsg := "only --scale or --max-scale can be specified"
+	expectedErrMsg := "only --scale or --scale-max can be specified"
 	if !strings.Contains(err.Error(), expectedErrMsg) {
 		t.Errorf("Invalid error output, expected: %s, got : '%s'", expectedErrMsg, err)
 	}
@@ -606,11 +606,11 @@ func TestServiceCreateScaleWithMaxScaleSet(t *testing.T) {
 func TestServiceCreateScaleWithMinScaleSet(t *testing.T) {
 	_, _, _, err := fakeServiceCreate([]string{
 		"service", "create", "foo", "--image", "gcr.io/foo/bar:baz",
-		"--scale", "5", "--min-scale", "2", "--no-wait"}, true)
+		"--scale", "5", "--scale-min", "2", "--no-wait"}, true)
 	if err == nil {
 		t.Fatal(err)
 	}
-	expectedErrMsg := "only --scale or --min-scale can be specified"
+	expectedErrMsg := "only --scale or --scale-min can be specified"
 	if !strings.Contains(err.Error(), expectedErrMsg) {
 		t.Errorf("Invalid error output, expected: %s, got : '%s'", expectedErrMsg, err)
 	}
diff --git a/pkg/kn/commands/service/update_test.go b/pkg/kn/commands/service/update_test.go
index f02c21f1..1f5fe950 100644
--- a/pkg/kn/commands/service/update_test.go
+++ b/pkg/kn/commands/service/update_test.go
@@ -320,7 +320,7 @@ func TestServiceUpdateMaxMinScale(t *testing.T) {
 
 	action, updated, _, err := fakeServiceUpdate(original, []string{
 		"service", "update", "foo",
-		"--min-scale", "1", "--max-scale", "5", "--concurrency-target", "10", "--concurrency-limit", "100", "--concurrency-utilization", "50", "--no-wait"})
+		"--scale-min", "1", "--scale-max", "5", "--concurrency-target", "10", "--concurrency-limit", "100", "--concurrency-utilization", "50", "--no-wait"})
 
 	if err != nil {
 		t.Fatal(err)
@@ -413,13 +413,13 @@ func TestServiceUpdateScaleWithMaxScaleSet(t *testing.T) {
 
 	_, _, _, err := fakeServiceUpdate(original, []string{
 		"service", "update", "foo",
-		"--scale", "5", "--max-scale", "2", "--no-wait"})
+		"--scale", "5", "--scale-max", "2", "--no-wait"})
 
 	if err == nil {
 		t.Fatal("Expected error, got nil")
 	}
 
-	expectedErrMsg := "only --scale or --max-scale can be specified"
+	expectedErrMsg := "only --scale or --scale-max can be specified"
 
 	if !strings.Contains(err.Error(), expectedErrMsg) {
 		t.Errorf("Invalid error output, expected: %s, got : '%s'", expectedErrMsg, err)
@@ -432,13 +432,13 @@ func TestServiceUpdateScaleWithMinScaleSet(t *testing.T) {
 
 	_, _, _, err := fakeServiceUpdate(original, []string{
 		"service", "update", "foo",
-		"--scale", "5", "--min-scale", "2", "--no-wait"})
+		"--scale", "5", "--scale-min", "2", "--no-wait"})
 
 	if err == nil {
 		t.Fatal("Expected error, got nil")
 	}
 
-	expectedErrMsg := "only --scale or --min-scale can be specified"
+	expectedErrMsg := "only --scale or --scale-min can be specified"
 
 	if !strings.Contains(err.Error(), expectedErrMsg) {
 		t.Errorf("Invalid error output, expected: %s, got : '%s'", expectedErrMsg, err)
diff --git a/test/e2e-tests.sh b/test/e2e-tests.sh
index cbde7035..d9f740d7 100755
--- a/test/e2e-tests.sh
+++ b/test/e2e-tests.sh
@@ -61,6 +61,12 @@ smoke_test() {
   # Test namespace
   ns="kne2esmoketests"
 
+  # Test image
+  img=${KN_TEST_IMAGE}
+  if [[ -z "${KN_TEST_IMAGE}" ]]; then
+    img="gcr.io/knative-samples/helloworld-go"
+  fi
+
   set -x
 
   kubectl create ns $ns || fail_test
@@ -68,15 +74,15 @@ smoke_test() {
 
   sleep 4 # Wait for the namespace to get initialized by kube-controller-manager
 
-  ./kn service create svc1 --no-wait --image gcr.io/knative-samples/helloworld-go -e TARGET=Knative -n $ns || fail_test
-  ./kn service create svc2 --no-wait --image gcr.io/knative-samples/helloworld-go -e TARGET=Knative -n $ns || fail_test
-  ./kn service create hello --image gcr.io/knative-samples/helloworld-go -e TARGET=Knative -n $ns || fail_test
+  ./kn service create svc1 --no-wait --image $img -e TARGET=Knative -n $ns || fail_test
+  ./kn service create svc2 --no-wait --image $img -e TARGET=Knative -n $ns || fail_test
+  ./kn service create hello --image $img -e TARGET=Knative -n $ns || fail_test
   ./kn service list hello -n $ns || fail_test
   ./kn service update hello --env TARGET=kn -n $ns || fail_test
   ./kn revision list hello -n $ns || fail_test
   ./kn service list -n $ns || fail_test
-  ./kn service create hello --force --image gcr.io/knative-samples/helloworld-go -e TARGET=Awesome -n $ns || fail_test
-  ./kn service create foo --force --image gcr.io/knative-samples/helloworld-go -e TARGET=foo -n $ns || fail_test
+  ./kn service create hello --force --image $img -e TARGET=Awesome -n $ns || fail_test
+  ./kn service create foo --force --image $img -e TARGET=foo -n $ns || fail_test
   ./kn revision list -n $ns || fail_test
   ./kn service list -n $ns || fail_test
   ./kn service describe hello -n $ns || fail_test
diff --git a/test/e2e/service_export_test.go b/test/e2e/service_export_test.go
index 6c74a910..61eaf49d 100644
--- a/test/e2e/service_export_test.go
+++ b/test/e2e/service_export_test.go
@@ -136,7 +136,7 @@ func TestServiceExport(t *testing.T) {
 			withRevisionName("hello-rev1"),
 			withRevisionAnnotations(
 				map[string]string{
-					"client.knative.dev/user-image": "gcr.io/knative-samples/helloworld-go",
+					"client.knative.dev/user-image": test.GetKnTestImage(),
 				}),
 			withRevisionLabels(
 				map[string]string{
@@ -198,7 +198,7 @@ func TestServiceExport(t *testing.T) {
 			withRevisionName("hello-rev1"),
 			withRevisionAnnotations(
 				map[string]string{
-					"client.knative.dev/user-image": "gcr.io/knative-samples/helloworld-go",
+					"client.knative.dev/user-image": test.GetKnTestImage(),
 				}),
 			withRevisionLabels(
 				map[string]string{
@@ -399,7 +399,7 @@ func withConfigurationLabels(labels map[string]string) expectedServiceOption {
 func withConfigurationAnnotations() expectedServiceOption {
 	return func(svc *servingv1.Service) {
 		svc.Spec.Template.ObjectMeta.Annotations = map[string]string{
-			"client.knative.dev/user-image": "gcr.io/knative-samples/helloworld-go",
+			"client.knative.dev/user-image": test.GetKnTestImage(),
 		}
 	}
 }
@@ -489,7 +489,7 @@ func withContainer() podSpecOption {
 		spec.Containers = []corev1.Container{
 			{
 				Name:      "user-container",
-				Image:     test.KnDefaultTestImage,
+				Image:     test.GetKnTestImage(),
 				Resources: corev1.ResourceRequirements{},
 				ReadinessProbe: &corev1.Probe{
 					SuccessThreshold: int32(1),
diff --git a/test/e2e/service_file_test.go b/test/e2e/service_file_test.go
index e5a0f441..3d3094b7 100644
--- a/test/e2e/service_file_test.go
+++ b/test/e2e/service_file_test.go
@@ -87,8 +87,8 @@ func TestServiceCreateFromFile(t *testing.T) {
 	defer os.RemoveAll(tempDir)
 	assert.NilError(t, err)
 
-	test.CreateFile("foo.json", fmt.Sprintf(ServiceJSON, test.KnDefaultTestImage), tempDir, test.FileModeReadWrite)
-	test.CreateFile("foo.yaml", fmt.Sprintf(ServiceYAML, test.KnDefaultTestImage), tempDir, test.FileModeReadWrite)
+	test.CreateFile("foo.json", fmt.Sprintf(ServiceJSON, test.GetKnTestImage()), tempDir, test.FileModeReadWrite)
+	test.CreateFile("foo.yaml", fmt.Sprintf(ServiceYAML, test.GetKnTestImage()), tempDir, test.FileModeReadWrite)
 
 	t.Log("create foo-json service from JSON file")
 	serviceCreateFromFile(r, "foo-json", filepath.Join(tempDir, "foo.json"), true)
diff --git a/test/e2e/service_options_test.go b/test/e2e/service_options_test.go
index 6d071a5a..212178c1 100644
--- a/test/e2e/service_options_test.go
+++ b/test/e2e/service_options_test.go
@@ -68,12 +68,12 @@ func TestServiceOptions(t *testing.T) {
 	test.ServiceDelete(r, "svc1")
 
 	t.Log("create and validate service with min/max scale options")
-	serviceCreateWithOptions(r, "svc2", "--min-scale", "1", "--max-scale", "3")
+	serviceCreateWithOptions(r, "svc2", "--scale-min", "1", "--scale-max", "3")
 	validateServiceMinScale(r, "svc2", "1")
 	validateServiceMaxScale(r, "svc2", "3")
 
 	t.Log("update and validate service with max scale option")
-	test.ServiceUpdate(r, "svc2", "--max-scale", "2")
+	test.ServiceUpdate(r, "svc2", "--scale-max", "2")
 	validateServiceMaxScale(r, "svc2", "2")
 
 	t.Log("create and validate service with scale options")
@@ -140,7 +140,7 @@ func TestServiceOptions(t *testing.T) {
 }
 
 func serviceCreateWithOptions(r *test.KnRunResultCollector, serviceName string, options ...string) {
-	command := []string{"service", "create", serviceName, "--image", test.KnDefaultTestImage}
+	command := []string{"service", "create", serviceName, "--image", test.GetKnTestImage()}
 	command = append(command, options...)
 	out := r.KnTest().Kn().Run(command...)
 	assert.Check(r.T(), util.ContainsAll(out.Stdout, "service", serviceName, "Creating", "namespace", r.KnTest().Kn().Namespace(), "Ready"))
diff --git a/test/e2e/service_test.go b/test/e2e/service_test.go
index 900c5d3a..128cb10c 100644
--- a/test/e2e/service_test.go
+++ b/test/e2e/service_test.go
@@ -72,7 +72,7 @@ func TestService(t *testing.T) {
 
 func serviceCreatePrivate(r *test.KnRunResultCollector, serviceName string) {
 	out := r.KnTest().Kn().Run("service", "create", serviceName,
-		"--image", test.KnDefaultTestImage, "--cluster-local")
+		"--image", test.GetKnTestImage(), "--cluster-local")
 	r.AssertNoError(out)
 	assert.Check(r.T(), util.ContainsAllIgnoreCase(out.Stdout, "service", serviceName, "creating", "namespace", r.KnTest().Kn().Namespace(), "ready"))
 
@@ -83,7 +83,7 @@ func serviceCreatePrivate(r *test.KnRunResultCollector, serviceName string) {
 
 func serviceCreatePrivateUpdatePublic(r *test.KnRunResultCollector, serviceName string) {
 	out := r.KnTest().Kn().Run("service", "create", serviceName,
-		"--image", test.KnDefaultTestImage, "--cluster-local")
+		"--image", test.GetKnTestImage(), "--cluster-local")
 	r.AssertNoError(out)
 	assert.Check(r.T(), util.ContainsAllIgnoreCase(out.Stdout, "service", serviceName, "creating", "namespace", r.KnTest().Kn().Namespace(), "ready"))
 
@@ -92,7 +92,7 @@ func serviceCreatePrivateUpdatePublic(r *test.KnRunResultCollector, serviceName
 	assert.Check(r.T(), util.ContainsAllIgnoreCase(out.Stdout, serving.VisibilityLabelKey, serving.VisibilityClusterLocal))
 
 	out = r.KnTest().Kn().Run("service", "update", serviceName,
-		"--image", test.KnDefaultTestImage, "--no-cluster-local")
+		"--image", test.GetKnTestImage(), "--no-cluster-local")
 	r.AssertNoError(out)
 	assert.Check(r.T(), util.ContainsAllIgnoreCase(out.Stdout, "service", serviceName, "updated", "namespace", r.KnTest().Kn().Namespace(), "ready"))
 
@@ -106,7 +106,7 @@ func serviceCreateDuplicate(r *test.KnRunResultCollector, serviceName string) {
 	r.AssertNoError(out)
 	assert.Check(r.T(), strings.Contains(out.Stdout, serviceName), "The service does not exist yet")
 
-	out = r.KnTest().Kn().Run("service", "create", serviceName, "--image", test.KnDefaultTestImage)
+	out = r.KnTest().Kn().Run("service", "create", serviceName, "--image", test.GetKnTestImage())
 	r.AssertError(out)
 	assert.Check(r.T(), util.ContainsAll(out.Stderr, "the service already exists"))
 }