MCPcopy Index your code
hub / github.com/helm/helm / TestBuildTable

Function TestBuildTable

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

Source from the content-addressed store, hash-verified

617}
618
619func TestBuildTable(t *testing.T) {
620 tests := []struct {
621 name string
622 namespace string
623 reader io.Reader
624 count int
625 err bool
626 }{
627 {
628 name: "Valid input",
629 namespace: "test",
630 reader: strings.NewReader(guestbookManifest),
631 count: 6,
632 }, {
633 name: "Valid input, deploying resources into different namespaces",
634 namespace: "test",
635 reader: strings.NewReader(namespacedGuestbookManifest),
636 count: 1,
637 },
638 }
639
640 c := newTestClient(t)
641 for _, tt := range tests {
642 t.Run(tt.name, func(t *testing.T) {
643 // Test for an invalid manifest
644 infos, err := c.BuildTable(tt.reader, false)
645 if err != nil && !tt.err {
646 t.Errorf("Got error message when no error should have occurred: %v", err)
647 } else if err != nil && strings.Contains(err.Error(), "--validate=false") {
648 t.Error("error message was not scrubbed")
649 }
650
651 if len(infos) != tt.count {
652 t.Errorf("expected %d result objects, got %d", tt.count, len(infos))
653 }
654 })
655 }
656}
657
658func TestPerform(t *testing.T) {
659 tests := []struct {

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…