MCPcopy
hub / github.com/helm/helm / TestValidateValuesFileSchemaFailure

Function TestValidateValuesFileSchemaFailure

pkg/chart/v2/lint/rules/values_test.go:86–100  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

84}
85
86func TestValidateValuesFileSchemaFailure(t *testing.T) {
87 // 1234 is an int, not a string. This should fail.
88 yaml := "username: 1234\npassword: swordfish"
89 tmpdir := ensure.TempFile(t, "values.yaml", []byte(yaml))
90 createTestingSchema(t, tmpdir)
91
92 valfile := filepath.Join(tmpdir, "values.yaml")
93
94 err := validateValuesFile(valfile, map[string]any{}, false)
95 if err == nil {
96 t.Fatal("expected values file to fail parsing")
97 }
98
99 assert.Contains(t, err.Error(), "- at '/username': got number, want string")
100}
101
102func TestValidateValuesFileSchemaFailureButWithSkipSchemaValidation(t *testing.T) {
103 // 1234 is an int, not a string. This should fail normally but pass with skipSchemaValidation.

Callers

nothing calls this directly

Calls 6

TempFileFunction · 0.92
FatalMethod · 0.80
ContainsMethod · 0.80
createTestingSchemaFunction · 0.70
validateValuesFileFunction · 0.70
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…