From 86590826e839cccb509c787371a8e591886e54d4 Mon Sep 17 00:00:00 2001 From: Appu Goundan Date: Fri, 28 Feb 2020 17:38:44 -0500 Subject: [PATCH 1/2] Add profile option to RunBuilder in test helper --- integration/skaffold/helper.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/integration/skaffold/helper.go b/integration/skaffold/helper.go index db4296abced..e932bea957b 100644 --- a/integration/skaffold/helper.go +++ b/integration/skaffold/helper.go @@ -41,6 +41,7 @@ type RunBuilder struct { dir string ns string repo string + profiles []string args []string env []string stdin []byte @@ -150,6 +151,12 @@ func (b *RunBuilder) WithEnv(env []string) *RunBuilder { return b } +// WithProfiles sets profiles. +func (b *RunBuilder) WithProfiles(profiles []string) *RunBuilder { + b.profiles = profiles + return b +} + // RunBackground runs the skaffold command in the background. // Returns a teardown function that stops skaffold. func (b *RunBuilder) RunBackground(t *testing.T) context.CancelFunc { @@ -262,6 +269,9 @@ func (b *RunBuilder) cmd(ctx context.Context) *exec.Cmd { if b.repo != "" && command.Flags().Lookup("default-repo") != nil { args = append(args, "--default-repo", b.repo) } + if b.profiles != nil && len(b.profiles) > 0 && command.Flags().Lookup("profile") != nil { + args = append(args, "--profile", strings.Join(b.profiles, ",")) + } args = append(args, b.args...) cmd := exec.CommandContext(ctx, "skaffold", args...) From 76ebb1993c5cde649fab9c907fb21c31d7bede91 Mon Sep 17 00:00:00 2001 From: Appu Date: Sat, 29 Feb 2020 20:46:06 -0500 Subject: [PATCH 2/2] Update integration/skaffold/helper.go Co-Authored-By: David Gageot --- integration/skaffold/helper.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration/skaffold/helper.go b/integration/skaffold/helper.go index e932bea957b..dd481f1157a 100644 --- a/integration/skaffold/helper.go +++ b/integration/skaffold/helper.go @@ -269,7 +269,7 @@ func (b *RunBuilder) cmd(ctx context.Context) *exec.Cmd { if b.repo != "" && command.Flags().Lookup("default-repo") != nil { args = append(args, "--default-repo", b.repo) } - if b.profiles != nil && len(b.profiles) > 0 && command.Flags().Lookup("profile") != nil { + if len(b.profiles) > 0 && command.Flags().Lookup("profile") != nil { args = append(args, "--profile", strings.Join(b.profiles, ",")) } args = append(args, b.args...)