From a38b55410fb994a97db74d0dc5a50db48546e8a8 Mon Sep 17 00:00:00 2001 From: Marlon Gamez Date: Thu, 7 Apr 2022 10:28:01 -0700 Subject: [PATCH 1/2] fix: add default value for status-check flag when no value is specified --- cmd/skaffold/app/cmd/flags.go | 1 + 1 file changed, 1 insertion(+) diff --git a/cmd/skaffold/app/cmd/flags.go b/cmd/skaffold/app/cmd/flags.go index 7052e7dc984..63a0c2469d0 100644 --- a/cmd/skaffold/app/cmd/flags.go +++ b/cmd/skaffold/app/cmd/flags.go @@ -320,6 +320,7 @@ var flagRegistry = []Flag{ FlagAddMethod: "Var", DefinedOn: []string{"dev", "debug", "deploy", "run", "apply"}, IsEnum: true, + NoOptDefVal: "true", }, { Name: "iterative-status-check", From 757d76c9761297ed275b947a8687cd30fe2d6af0 Mon Sep 17 00:00:00 2001 From: Marlon Gamez Date: Thu, 7 Apr 2022 13:48:55 -0700 Subject: [PATCH 2/2] ci: add integration test to ensure that no opt default flags work without a value passed --- integration/run_test.go | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/integration/run_test.go b/integration/run_test.go index b5db850a991..19173a801e2 100644 --- a/integration/run_test.go +++ b/integration/run_test.go @@ -458,3 +458,34 @@ func TestRunTest(t *testing.T) { }) } } + +// TestRunNoOptFlags tests to ensure that flags that don't require a value to be passed work when no value is passed +func TestRunNoOptFlags(t *testing.T) { + test := struct { + description string + dir string + targetLog string + pods []string + args []string + }{ + description: "getting-started", + dir: "testdata/getting-started", + pods: []string{"getting-started"}, + targetLog: "Hello world!", + args: []string{ + "--port-forward", + "--status-check", + }, + } + + MarkIntegrationTest(t, CanRunWithoutGcp) + t.Run(test.description, func(t *testing.T) { + ns, _ := SetupNamespace(t) + + args := append(test.args, "--tail") + out := skaffold.Run(args...).InDir(test.dir).InNs(ns.Name).RunLive(t) + defer skaffold.Delete().InDir(test.dir).InNs(ns.Name).RunOrFail(t) + + WaitForLogs(t, out, test.targetLog) + }) +}