mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-13 18:10:59 +00:00
Fix 3424 by avoiding a JSON round trip
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
package krusty_test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
kusttest_test "sigs.k8s.io/kustomize/api/testutils/kusttest"
|
||||
@@ -12,6 +13,7 @@ import (
|
||||
// Demonstrate unwanted quotes added to an integer by a strategic merge patch.
|
||||
func TestIssue3424Basics(t *testing.T) {
|
||||
th := kusttest_test.MakeHarness(t)
|
||||
opts := th.MakeDefaultOptions()
|
||||
th.WriteF("pdb-patch.yaml", `
|
||||
apiVersion: policy/v1beta1
|
||||
kind: PodDisruptionBudget
|
||||
@@ -51,8 +53,8 @@ patches:
|
||||
resources:
|
||||
- my_file.yaml
|
||||
`)
|
||||
m := th.Run(".", th.MakeDefaultOptions())
|
||||
th.AssertActualEqualsExpected(m, `
|
||||
m := th.Run(".", opts)
|
||||
expFmt := `
|
||||
apiVersion: policy/v1beta1
|
||||
kind: PodDisruptionBudget
|
||||
metadata:
|
||||
@@ -60,7 +62,7 @@ metadata:
|
||||
faceit-pdb: default
|
||||
name: championships-api
|
||||
spec:
|
||||
maxUnavailable: "1"
|
||||
maxUnavailable: %s
|
||||
---
|
||||
apiVersion: policy/v1beta1
|
||||
kind: PodDisruptionBudget
|
||||
@@ -69,6 +71,9 @@ metadata:
|
||||
faceit-pdb: default
|
||||
name: championships-api-2
|
||||
spec:
|
||||
maxUnavailable: "1"
|
||||
`)
|
||||
maxUnavailable: %s
|
||||
`
|
||||
th.AssertActualEqualsExpected(m, opts.IfApiMachineryElseKyaml(
|
||||
fmt.Sprintf(expFmt, `"1"`, `"1"`),
|
||||
fmt.Sprintf(expFmt, `1`, `1`)))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user