diff --git a/test/e2e/service_options_test.go b/test/e2e/service_options_test.go index 4d621603a..e1acb58f4 100644 --- a/test/e2e/service_options_test.go +++ b/test/e2e/service_options_test.go @@ -87,6 +87,15 @@ func TestServiceOptions(t *testing.T) { test.validateAutoscaleWindow(t, "svc4", "15s") test.serviceDelete(t, "svc4") }) + + t.Run("create, update and validate service with cmd and arg options", func(t *testing.T) { + test.serviceCreateWithOptions(t, "svc5", []string{"--cmd", "/go/bin/helloworld"}) + test.validateContainerField(t, "svc5", "command", "[/go/bin/helloworld]") + test.serviceUpdate(t, "svc5", []string{"--arg", "myArg1", "--arg", "--myArg2"}) + test.validateContainerField(t, "svc5", "args", "[myArg1 --myArg2]") + test.serviceUpdate(t, "svc5", []string{"--arg", "myArg1"}) + test.validateContainerField(t, "svc5", "args", "[myArg1]") + }) } func (test *e2eTest) serviceCreateWithOptions(t *testing.T, serviceName string, options []string) { @@ -191,3 +200,10 @@ func (test *e2eTest) validateServiceAnnotations(t *testing.T, serviceName string } } } + +func (test *e2eTest) validateContainerField(t *testing.T, serviceName, field, expected string) { + jsonpath := fmt.Sprintf("jsonpath={.items[0].spec.template.spec.containers[0].%s}", field) + out, err := test.kn.RunWithOpts([]string{"service", "list", serviceName, "-o", jsonpath}, runOpts{}) + assert.NilError(t, err) + assert.Equal(t, out, expected) +}