change args to use flags instead, so that values starting with hyphen can be correctly parsed.

This commit is contained in:
Jijie Wei
2020-05-26 17:22:04 -07:00
parent 144471ce78
commit 572260c0f0
5 changed files with 335 additions and 13 deletions

View File

@@ -166,6 +166,43 @@ kind: Example
spec:
list:
- "a" # {"$openapi":"list"}
`,
},
{
name: "add replicas with value set by flag",
args: []string{"replicas", "--value", "3", "--description", "hello world", "--set-by", "me"},
input: `
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
spec:
replicas: 3
`,
inputOpenAPI: `
apiVersion: v1alpha1
kind: Example
`,
expectedOpenAPI: `
apiVersion: v1alpha1
kind: Example
openAPI:
definitions:
io.k8s.cli.setters.replicas:
description: hello world
x-k8s-cli:
setter:
name: replicas
value: "3"
setBy: me
`,
expectedResources: `
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
spec:
replicas: 3 # {"$ref":"#/definitions/io.k8s.cli.setters.replicas"}
`,
},
}