Add tests for helm install with schema

Signed-off-by: Ian Howell <ian.howell0@gmail.com>
pull/5350/head
Ian Howell 7 years ago
parent a77a6586fc
commit e97ec08992

@ -136,6 +136,33 @@ func TestInstall(t *testing.T) {
wantError: true, wantError: true,
golden: "output/install-chart-bad-type.txt", golden: "output/install-chart-bad-type.txt",
}, },
// Install, values from yaml, schematized
{
name: "install with schema file",
cmd: "install schema testdata/testcharts/chart-with-schema",
golden: "output/schema.txt",
},
// Install, values from yaml, schematized with errors
{
name: "install with schema file, with errors",
cmd: "install schema testdata/testcharts/chart-with-schema-negative",
wantError: true,
golden: "output/schema-negative.txt",
},
// Install, values from yaml, extra values from yaml, schematized with errors
{
name: "install with schema file, extra values from yaml, with errors",
cmd: "install schema testdata/testcharts/chart-with-schema -f testdata/testcharts/chart-with-schema/extra-values.yaml",
wantError: true,
golden: "output/schema-negative.txt",
},
// Install, values from yaml, extra values from cli, schematized with errors
{
name: "install with schema file, extra values from cli, with errors",
cmd: "install schema testdata/testcharts/chart-with-schema --set age=-5",
wantError: true,
golden: "output/schema-negative-cli.txt",
},
} }
runTestActionCmd(t, tests) runTestActionCmd(t, tests)

@ -0,0 +1,3 @@
Error: .Values does not meet the specification of values.schema.yaml . see errors :
- age: Must be greater than or equal to 0/1

@ -0,0 +1,4 @@
Error: .Values does not meet the specification of values.schema.yaml . see errors :
- (root): employmentInfo is required
- age: Must be greater than or equal to 0/1

@ -0,0 +1,5 @@
NAME: schema
LAST DEPLOYED: 1977-09-02 22:04:05 +0000 UTC
NAMESPACE: default
STATUS: deployed

@ -0,0 +1,6 @@
description: Empty testing chart
home: https://k8s.io/helm
name: empty
sources:
- https://github.com/kubernetes/helm
version: 0.1.0

@ -0,0 +1,3 @@
#Empty
This space intentionally left blank.

@ -0,0 +1,45 @@
title: Values
type: object
properties:
firstname:
description: First name
type: string
lastname:
type: string
likesCoffee:
type: boolean
age:
description: Age
type: integer
minimum: 0
employmentInfo:
type: object
properties:
salary:
type: number
minimum: 0
title:
type: string
required:
- salary
addresses:
description: List of addresses
type: array
items:
type: object
properties:
city:
type: string
street:
type: string
number:
type: number
phoneNumbers:
type: array
items:
type: string
required:
- firstname
- lastname
- addresses
- employmentInfo

@ -0,0 +1,14 @@
firstname: John
lastname: Doe
age: -5
likesCoffee: true
addresses:
- city: Springfield
street: Main
number: 12345
- city: New York
street: Broadway
number: 67890
phoneNumbers:
- "(888) 888-8888"
- "(555) 555-5555"

@ -0,0 +1,6 @@
description: Empty testing chart
home: https://k8s.io/helm
name: empty
sources:
- https://github.com/kubernetes/helm
version: 0.1.0

@ -0,0 +1,3 @@
#Empty
This space intentionally left blank.

@ -0,0 +1,2 @@
age: -5
employmentInfo: null

@ -0,0 +1 @@
# This file is intentionally blank

@ -0,0 +1,45 @@
title: Values
type: object
properties:
firstname:
description: First name
type: string
lastname:
type: string
likesCoffee:
type: boolean
age:
description: Age
type: integer
minimum: 0
employmentInfo:
type: object
properties:
salary:
type: number
minimum: 0
title:
type: string
required:
- salary
addresses:
description: List of addresses
type: array
items:
type: object
properties:
city:
type: string
street:
type: string
number:
type: number
phoneNumbers:
type: array
items:
type: string
required:
- firstname
- lastname
- addresses
- employmentInfo

@ -0,0 +1,17 @@
firstname: John
lastname: Doe
age: 25
likesCoffee: true
employmentInfo:
title: Software Developer
salary: 100000
addresses:
- city: Springfield
street: Main
number: 12345
- city: New York
street: Broadway
number: 67890
phoneNumbers:
- "(888) 888-8888"
- "(555) 555-5555"
Loading…
Cancel
Save