Revert "fix: support integer keys when marshaling resources to JSON"

This commit is contained in:
yugo kobayashi
2026-08-20 08:52:50 +09:00
committed by GitHub
parent db6d67b043
commit 35875a0b55
3 changed files with 14 additions and 31 deletions

View File

@@ -9,31 +9,6 @@ import (
kusttest_test "sigs.k8s.io/kustomize/api/testutils/kusttest"
)
func TestIntegerKey(t *testing.T) {
th := kusttest_test.MakeHarness(t)
th.WriteK(".", `
resources:
- cm.yaml
`)
th.WriteF("cm.yaml", `
apiVersion: v1
kind: ConfigMap
metadata:
name: cm
data:
123: abc
`)
m := th.Run(".", th.MakeDefaultOptions())
th.AssertActualEqualsExpected(m, `
apiVersion: v1
data:
"123": abc
kind: ConfigMap
metadata:
name: cm
`)
}
// Numbers and booleans are quoted
func TestGeneratorIntVsStringNoMerge(t *testing.T) {
th := kusttest_test.MakeHarness(t)

View File

@@ -43,5 +43,5 @@ spec:
m := th.Run(".", th.MakeDefaultOptions())
_, err := m.AsYaml()
require.Error(t, err)
assert.Contains(t, err.Error(), "key \"env\" already set in map")
assert.Contains(t, err.Error(), "mapping key \"env\" already defined")
}