updated patch delete test

This commit is contained in:
Natasha Sarkar
2021-01-26 16:42:59 -08:00
parent a8278b6da9
commit 48676fe34b
2 changed files with 2 additions and 25 deletions

View File

@@ -60,11 +60,10 @@ func (p *PatchStrategicMergeTransformerPlugin) Config(
"patch appears to be empty; files=%v, Patch=%s", p.Paths, p.Patches)
}
// Merge the patches, looking for conflicts.
m, err := h.ResmapFactory().ConflatePatches(p.loadedPatches)
_, err = h.ResmapFactory().ConflatePatches(p.loadedPatches)
if err != nil {
return err
}
p.loadedPatches = m.Resources()
return nil
}

View File

@@ -69,28 +69,6 @@ spec:
image: helloworld
name: whatever
`
// Allow expected variable to be unused
_ = expected
// Currently, kustomize inserts $patch: delete elements into the resulting resources
erroneousActual := `
apiVersion: apps/v1
kind: Deployment
metadata:
name: whatever
spec:
template:
spec:
containers:
- env:
- $patch: delete
name: NOT_EXISTING_FOR_REMOVAL
- name: EXISTING
value: EXISTING_VALUE
image: helloworld
name: whatever
`
m := th.Run(".", th.MakeDefaultOptions())
th.AssertActualEqualsExpected(m, erroneousActual)
th.AssertActualEqualsExpected(m, expected)
}