MCPcopy
hub / github.com/helm/helm / TestUpdateCmdMultiple

Function TestUpdateCmdMultiple

pkg/cmd/repo_update_test.go:58–82  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

56}
57
58func TestUpdateCmdMultiple(t *testing.T) {
59 var out bytes.Buffer
60 // Instead of using the HTTP updater, we provide our own for this test.
61 // The TestUpdateCharts test verifies the HTTP behavior independently.
62 updater := func(repos []*repo.ChartRepository, out io.Writer) error {
63 for _, re := range repos {
64 fmt.Fprintln(out, re.Config.Name)
65 }
66 return nil
67 }
68 o := &repoUpdateOptions{
69 update: updater,
70 repoFile: "testdata/repositories.yaml",
71 names: []string{"firstexample", "charts"},
72 }
73 if err := o.run(&out); err != nil {
74 t.Fatal(err)
75 }
76
77 if got := out.String(); !strings.Contains(got, "charts") ||
78 !strings.Contains(got, "firstexample") ||
79 strings.Contains(got, "secondexample") {
80 t.Errorf("Expected 'charts' and 'firstexample' but not 'secondexample' but got %q", got)
81 }
82}
83
84func TestUpdateCmdInvalid(t *testing.T) {
85 var out bytes.Buffer

Callers

nothing calls this directly

Calls 4

runMethod · 0.95
FatalMethod · 0.80
ContainsMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…