MCPcopy
hub / github.com/helm/helm / TestValidate

Function TestValidate

pkg/chart/v2/metadata_test.go:23–199  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

21)
22
23func TestValidate(t *testing.T) {
24 tests := []struct {
25 name string
26 md *Metadata
27 err error
28 }{
29 {
30 "chart without metadata",
31 nil,
32 ValidationError("chart.metadata is required"),
33 },
34 {
35 "chart without apiVersion",
36 &Metadata{Name: "test", Version: "1.0"},
37 ValidationError("chart.metadata.apiVersion is required"),
38 },
39 {
40 "chart without name",
41 &Metadata{APIVersion: "v2", Version: "1.0"},
42 ValidationError("chart.metadata.name is required"),
43 },
44 {
45 "chart with dot name",
46 &Metadata{Name: ".", APIVersion: "v2", Version: "1.0"},
47 ValidationError("chart.metadata.name \".\" is not allowed"),
48 },
49 {
50 "chart with dotdot name",
51 &Metadata{Name: "..", APIVersion: "v2", Version: "1.0"},
52 ValidationError("chart.metadata.name \"..\" is not allowed"),
53 },
54 {
55 "chart without name",
56 &Metadata{Name: "../../test", APIVersion: "v2", Version: "1.0"},
57 ValidationError("chart.metadata.name \"../../test\" is invalid"),
58 },
59 {
60 "chart without version",
61 &Metadata{Name: "test", APIVersion: "v2"},
62 ValidationError("chart.metadata.version is required"),
63 },
64 {
65 "chart with bad type",
66 &Metadata{Name: "test", APIVersion: "v2", Version: "1.0", Type: "test"},
67 ValidationError("chart.metadata.type must be application or library"),
68 },
69 {
70 "chart without dependency",
71 &Metadata{Name: "test", APIVersion: "v2", Version: "1.0", Type: "application"},
72 nil,
73 },
74 {
75 "dependency with valid alias",
76 &Metadata{
77 Name: "test",
78 APIVersion: "v2",
79 Version: "1.0",
80 Type: "application",

Callers

nothing calls this directly

Calls 3

IsMethod · 0.80
ValidationErrorTypeAlias · 0.70
ValidateMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…