add negative tests

Signed-off-by: S.Cavallo <smcavallo@hotmail.com>
pull/5705/head
S.Cavallo 6 years ago
parent 27789f647c
commit ddc9cc82a0

@ -45,6 +45,12 @@ func TestTemplateCmd(t *testing.T) {
expectValue string expectValue string
expectError string expectError string
}{ }{
{
name: "check_negative_test",
desc: "run a negative check to test verification failures",
args: []string{subchart1ChartPath, "--test-outfile", filepath.Join(fixtureAbsPath, "subpop_fail_service.yaml")},
expectError: "verification failed",
},
{ {
name: "check_name", name: "check_name",
desc: "check for a known name in chart", desc: "check for a known name in chart",
@ -63,6 +69,12 @@ func TestTemplateCmd(t *testing.T) {
args: []string{subchart1ChartPath, "-x", "templates/thisdoesn'texist.yaml"}, args: []string{subchart1ChartPath, "-x", "templates/thisdoesn'texist.yaml"},
expectError: "could not find template", expectError: "could not find template",
}, },
{
name: "check_execute_non_existent_outfile",
desc: "verify --execute fails on a test file which doesn't exist",
args: []string{subchart1ChartPath, "--test-outfile", filepath.Join(fixtureAbsPath, "does_not_exist.yaml")},
expectError: "does not exist",
},
{ {
name: "check_execute_absolute", name: "check_execute_absolute",
desc: "verify --execute single template", desc: "verify --execute single template",

@ -0,0 +1,17 @@
---
# Source: subchart1/charts/subcharta/templates/service.yaml
apiVersion: v1
kind: Service
metadata:
name: subcharta
labels:
chart: "subcharta-0.1.0"
spec:
type: ClusterIP
ports:
- port: 80
targetPort: 80
protocol: TCP
name: fail_verification
selector:
app: subcharta
Loading…
Cancel
Save