diff --git a/cmd/helm/template_test.go b/cmd/helm/template_test.go index ac93a48aa..da111d0fe 100644 --- a/cmd/helm/template_test.go +++ b/cmd/helm/template_test.go @@ -45,6 +45,12 @@ func TestTemplateCmd(t *testing.T) { expectValue 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", 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"}, 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", desc: "verify --execute single template", diff --git a/cmd/helm/testdata/testcharts/chart-verify-templates/subpop_fail_service.yaml b/cmd/helm/testdata/testcharts/chart-verify-templates/subpop_fail_service.yaml new file mode 100644 index 000000000..746ea4d85 --- /dev/null +++ b/cmd/helm/testdata/testcharts/chart-verify-templates/subpop_fail_service.yaml @@ -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