MCPcopy
hub / github.com/helm/helm / verifyChart

Function verifyChart

pkg/chart/v2/loader/load_test.go:617–664  ·  view source on GitHub ↗
(t *testing.T, c *chart.Chart)

Source from the content-addressed store, hash-verified

615}
616
617func verifyChart(t *testing.T, c *chart.Chart) {
618 t.Helper()
619 if c.Name() == "" {
620 t.Fatalf("No chart metadata found on %v", c)
621 }
622 t.Logf("Verifying chart %s", c.Name())
623 if len(c.Templates) != 1 {
624 t.Errorf("Expected 1 template, got %d", len(c.Templates))
625 }
626
627 numfiles := 6
628 if len(c.Files) != numfiles {
629 t.Errorf("Expected %d extra files, got %d", numfiles, len(c.Files))
630 for _, n := range c.Files {
631 t.Logf("\t%s", n.Name)
632 }
633 }
634
635 if len(c.Dependencies()) != 2 {
636 t.Errorf("Expected 2 dependencies, got %d (%v)", len(c.Dependencies()), c.Dependencies())
637 for _, d := range c.Dependencies() {
638 t.Logf("\tSubchart: %s\n", d.Name())
639 }
640 }
641
642 expect := map[string]map[string]string{
643 "alpine": {
644 "version": "0.1.0",
645 },
646 "mariner": {
647 "version": "4.3.2",
648 },
649 }
650
651 for _, dep := range c.Dependencies() {
652 if dep.Metadata == nil {
653 t.Fatalf("expected metadata on dependency: %v", dep)
654 }
655 exp, ok := expect[dep.Name()]
656 if !ok {
657 t.Fatalf("Unknown dependency %s", dep.Name())
658 }
659 if exp["version"] != dep.Metadata.Version {
660 t.Errorf("Expected %s version %s, got %s", dep.Name(), exp["version"], dep.Metadata.Version)
661 }
662 }
663
664}
665
666func verifyDependencies(t *testing.T, c *chart.Chart) {
667 t.Helper()

Callers 6

TestLoadDirFunction · 0.70
TestLoadDirWithSymlinkFunction · 0.70
TestLoadDirWithUTFBOMFunction · 0.70
TestLoadFileFunction · 0.70
TestLoadFileBackslashFunction · 0.70

Calls 4

HelperMethod · 0.80
FatalfMethod · 0.80
NameMethod · 0.65
DependenciesMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…