Skip to content

Commit

Permalink
refactored code and renamed test method
Browse files Browse the repository at this point in the history
  • Loading branch information
sethiyash committed May 10, 2022
1 parent a5d68cb commit 72440b4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 3 additions & 5 deletions pkg/kapp/app/recorded_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion test/e2e/diff_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}}
Expand Down

0 comments on commit 72440b4

Please sign in to comment.