(t *testing.T)
| 351 | } |
| 352 | |
| 353 | func TestPullWithCredentialsCmd(t *testing.T) { |
| 354 | srv := repotest.NewTempServer( |
| 355 | t, |
| 356 | repotest.WithChartSourceGlob("testdata/testcharts/*.tgz*"), |
| 357 | repotest.WithMiddleware(repotest.BasicAuthMiddleware(t)), |
| 358 | ) |
| 359 | defer srv.Stop() |
| 360 | |
| 361 | srv2 := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { |
| 362 | http.FileServer(http.Dir(srv.Root())).ServeHTTP(w, r) |
| 363 | })) |
| 364 | defer srv2.Close() |
| 365 | |
| 366 | if err := srv.LinkIndices(); err != nil { |
| 367 | t.Fatal(err) |
| 368 | } |
| 369 | |
| 370 | // all flags will get "-d outdir" appended. |
| 371 | tests := []struct { |
| 372 | name string |
| 373 | args string |
| 374 | existFile string |
| 375 | existDir string |
| 376 | wantError bool |
| 377 | wantErrorMsg string |
| 378 | expectFile string |
| 379 | expectDir bool |
| 380 | }{ |
| 381 | { |
| 382 | name: "Chart fetch using repo URL", |
| 383 | expectFile: "./signtest-0.1.0.tgz", |
| 384 | args: "signtest --repo " + srv.URL() + " --username username --password password", |
| 385 | }, |
| 386 | { |
| 387 | name: "Fail fetching non-existent chart on repo URL", |
| 388 | args: "someChart --repo " + srv.URL() + " --username username --password password", |
| 389 | wantError: true, |
| 390 | }, |
| 391 | { |
| 392 | name: "Specific version chart fetch using repo URL", |
| 393 | expectFile: "./signtest-0.1.0.tgz", |
| 394 | args: "signtest --version=0.1.0 --repo " + srv.URL() + " --username username --password password", |
| 395 | }, |
| 396 | { |
| 397 | name: "Specific version chart fetch using repo URL", |
| 398 | args: "signtest --version=0.2.0 --repo " + srv.URL() + " --username username --password password", |
| 399 | wantError: true, |
| 400 | }, |
| 401 | { |
| 402 | name: "Chart located on different domain with credentials passed", |
| 403 | args: "reqtest --repo " + srv2.URL + " --username username --password password --pass-credentials", |
| 404 | expectFile: "./reqtest-0.1.0.tgz", |
| 405 | }, |
| 406 | } |
| 407 | |
| 408 | runPullTests(t, tests, srv.Root(), "") |
| 409 | } |
| 410 |
nothing calls this directly
no test coverage detected
searching dependent graphs…