MCPcopy
hub / github.com/helm/helm / TestBuild

Function TestBuild

pkg/kube/client_test.go:580–617  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

578}
579
580func TestBuild(t *testing.T) {
581 tests := []struct {
582 name string
583 namespace string
584 reader io.Reader
585 count int
586 err bool
587 }{
588 {
589 name: "Valid input",
590 namespace: "test",
591 reader: strings.NewReader(guestbookManifest),
592 count: 6,
593 }, {
594 name: "Valid input, deploying resources into different namespaces",
595 namespace: "test",
596 reader: strings.NewReader(namespacedGuestbookManifest),
597 count: 1,
598 },
599 }
600
601 c := newTestClient(t)
602 for _, tt := range tests {
603 t.Run(tt.name, func(t *testing.T) {
604 // Test for an invalid manifest
605 infos, err := c.Build(tt.reader, false)
606 if err != nil && !tt.err {
607 t.Errorf("Got error message when no error should have occurred: %v", err)
608 } else if err != nil && strings.Contains(err.Error(), "--validate=false") {
609 t.Error("error message was not scrubbed")
610 }
611
612 if len(infos) != tt.count {
613 t.Errorf("expected %d result objects, got %d", tt.count, len(infos))
614 }
615 })
616 }
617}
618
619func TestBuildTable(t *testing.T) {
620 tests := []struct {

Callers

nothing calls this directly

Calls 5

newTestClientFunction · 0.85
ContainsMethod · 0.80
RunMethod · 0.65
BuildMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…