MCPcopy
hub / github.com/helm/helm / TestCreateCmd

Function TestCreateCmd

pkg/cmd/create_test.go:36–74  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

34)
35
36func TestCreateCmd(t *testing.T) {
37 t.Chdir(t.TempDir())
38 ensure.HelmHome(t)
39 cname := "testchart"
40
41 // Run a create
42 if _, _, err := executeActionCommand("create " + cname); err != nil {
43 t.Fatalf("Failed to run create: %s", err)
44 }
45
46 // Test that the chart is there
47 if fi, err := os.Stat(cname); err != nil {
48 t.Fatalf("no chart directory: %s", err)
49 } else if !fi.IsDir() {
50 t.Fatal("chart is not directory")
51 }
52
53 c, err := chartloader.LoadDir(cname)
54 if err != nil {
55 t.Fatal(err)
56 }
57
58 acc, err := chart.NewAccessor(c)
59 if err != nil {
60 t.Fatal(err)
61 }
62
63 if acc.Name() != cname {
64 t.Errorf("Expected %q name, got %q", cname, acc.Name())
65 }
66 metadata := acc.MetadataAsMap()
67 apiVersion, ok := metadata["APIVersion"].(string)
68 if !ok {
69 t.Fatal("APIVersion not found in metadata")
70 }
71 if apiVersion != chartv2.APIVersionV2 {
72 t.Errorf("Wrong API version: %q", apiVersion)
73 }
74}
75
76func TestCreateStarterCmd(t *testing.T) {
77 tests := []struct {

Callers

nothing calls this directly

Calls 6

NameMethod · 0.95
MetadataAsMapMethod · 0.95
HelmHomeFunction · 0.92
executeActionCommandFunction · 0.85
FatalfMethod · 0.80
FatalMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…