MCPcopy
hub / github.com/helm/helm / TestPullWithCredentialsCmd

Function TestPullWithCredentialsCmd

pkg/cmd/pull_test.go:353–409  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

351}
352
353func 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

Callers

nothing calls this directly

Calls 12

NewTempServerFunction · 0.92
WithChartSourceGlobFunction · 0.92
WithMiddlewareFunction · 0.92
BasicAuthMiddlewareFunction · 0.92
runPullTestsFunction · 0.85
StopMethod · 0.80
CloseMethod · 0.80
LinkIndicesMethod · 0.80
FatalMethod · 0.80
URLMethod · 0.80
DirMethod · 0.65
RootMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…