MCPcopy
hub / github.com/helm/helm / TestRepoRemoveCompletion

Function TestRepoRemoveCompletion

pkg/cmd/repo_remove_test.go:165–213  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

163}
164
165func TestRepoRemoveCompletion(t *testing.T) {
166 ts := repotest.NewTempServer(
167 t,
168 repotest.WithChartSourceGlob("testdata/testserver/*.*"),
169 )
170
171 defer ts.Stop()
172
173 rootDir := t.TempDir()
174 repoFile := filepath.Join(rootDir, "repositories.yaml")
175 repoCache := filepath.Join(rootDir, "cache/")
176
177 var testRepoNames = []string{"foo", "bar", "baz"}
178
179 // Add test repos
180 for _, repoName := range testRepoNames {
181 o := &repoAddOptions{
182 name: repoName,
183 url: ts.URL(),
184 repoFile: repoFile,
185 }
186
187 if err := o.run(os.Stderr); err != nil {
188 t.Error(err)
189 }
190 }
191
192 repoSetup := fmt.Sprintf("--repository-config %s --repository-cache %s", repoFile, repoCache)
193
194 // In the following tests, we turn off descriptions for completions by using __completeNoDesc.
195 // We have to do this because the description will contain the port used by the webserver,
196 // and that port changes each time we run the test.
197 tests := []cmdTestCase{{
198 name: "completion for repo remove",
199 cmd: repoSetup + " __completeNoDesc repo remove ''",
200 golden: "output/repo_list_comp.txt",
201 }, {
202 name: "completion for repo remove, no filter",
203 cmd: repoSetup + " __completeNoDesc repo remove fo",
204 golden: "output/repo_list_comp.txt",
205 }, {
206 name: "completion for repo remove repetition",
207 cmd: repoSetup + " __completeNoDesc repo remove foo ''",
208 golden: "output/repo_repeat_comp.txt",
209 }}
210 for _, test := range tests {
211 runTestCmd(t, []cmdTestCase{test})
212 }
213}
214
215func TestRepoRemoveFileCompletion(t *testing.T) {
216 checkFileCompletion(t, "repo remove", false)

Callers

nothing calls this directly

Calls 7

runMethod · 0.95
NewTempServerFunction · 0.92
WithChartSourceGlobFunction · 0.92
runTestCmdFunction · 0.85
StopMethod · 0.80
URLMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…