mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-11 00:52:55 +00:00
Handle comments for seq indent derivation (#4064)
* Handle comments for seq indent derivation * Suggested changes
This commit is contained in:
@@ -118,6 +118,21 @@ spec: +
|
||||
`,
|
||||
expectedOutput: `compact`,
|
||||
},
|
||||
{
|
||||
name: "handle comments",
|
||||
input: `apiVersion: v1
|
||||
kind: Service
|
||||
spec:
|
||||
ports: # comment 1
|
||||
# comment 2
|
||||
- name: etcd-server-ssl
|
||||
port: 2380
|
||||
# comment 3
|
||||
- name: etcd-client-ssl
|
||||
port: 2379
|
||||
`,
|
||||
expectedOutput: `wide`,
|
||||
},
|
||||
{
|
||||
name: "nested wide vs compact",
|
||||
input: `apiVersion: apps/v1
|
||||
@@ -140,6 +155,15 @@ abc:
|
||||
input: ` - foo`,
|
||||
expectedOutput: `compact`,
|
||||
},
|
||||
{
|
||||
name: "invalid resource but valid yaml sequence with comments",
|
||||
input: `
|
||||
# comment 1
|
||||
# comment 2
|
||||
- foo
|
||||
`,
|
||||
expectedOutput: `compact`,
|
||||
},
|
||||
{
|
||||
name: "- within sequence element",
|
||||
input: `apiVersion: apps/v1
|
||||
|
||||
Reference in New Issue
Block a user