(t *testing.T)
| 163 | } |
| 164 | |
| 165 | func 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 | |
| 215 | func TestRepoRemoveFileCompletion(t *testing.T) { |
| 216 | checkFileCompletion(t, "repo remove", false) |
nothing calls this directly
no test coverage detected
searching dependent graphs…