From 72440b428fb11aa7ceb59c16fe117e0bb6899016 Mon Sep 17 00:00:00 2001 From: sethiyash Date: Tue, 10 May 2022 13:15:12 +0530 Subject: [PATCH] refactored code and renamed test method --- pkg/kapp/app/recorded_app.go | 8 +++----- test/e2e/diff_test.go | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/pkg/kapp/app/recorded_app.go b/pkg/kapp/app/recorded_app.go index b77177088..85549b189 100644 --- a/pkg/kapp/app/recorded_app.go +++ b/pkg/kapp/app/recorded_app.go @@ -197,13 +197,11 @@ func (a *RecordedApp) create(labels map[string]string, isDiffRun bool) error { return err } - var dryRunValue []string = nil - + createOpts := metav1.CreateOptions{} if isDiffRun { - dryRunValue = []string{metav1.DryRunAll} + createOpts.DryRun = []string{metav1.DryRunAll} } - - app, err := a.coreClient.CoreV1().ConfigMaps(a.nsName).Create(context.TODO(), configMap, metav1.CreateOptions{DryRun: dryRunValue}) + app, err := a.coreClient.CoreV1().ConfigMaps(a.nsName).Create(context.TODO(), configMap, createOpts) a.setMeta(*app) diff --git a/test/e2e/diff_test.go b/test/e2e/diff_test.go index 926e9aa63..b4b8f751a 100644 --- a/test/e2e/diff_test.go +++ b/test/e2e/diff_test.go @@ -376,7 +376,7 @@ data: require.Containsf(t, out, expectedOutput, "Did not find expected diff output") } -func TestKappNotCreateConfigmapOnDiffRun(t *testing.T) { +func TestDiffRun(t *testing.T) { env := BuildEnv(t) kapp := Kapp{t, env.Namespace, env.KappBinaryPath, Logger{}} kubectl := Kubectl{t, env.Namespace, Logger{}}