MCPcopy
hub / github.com/helm/helm / TestUpdateWithNoRepo

Function TestUpdateWithNoRepo

pkg/downloader/manager_test.go:374–438  ·  view source on GitHub ↗

TestUpdateWithNoRepo is for the case of a dependency that has no repo listed. This happens when the dependency is in the charts directory and does not need to be fetched.

(t *testing.T)

Source from the content-addressed store, hash-verified

372// This happens when the dependency is in the charts directory and does not need
373// to be fetched.
374func TestUpdateWithNoRepo(t *testing.T) {
375 // Set up a fake repo
376 srv := repotest.NewTempServer(
377 t,
378 repotest.WithChartSourceGlob("testdata/*.tgz*"),
379 )
380 defer srv.Stop()
381 if err := srv.LinkIndices(); err != nil {
382 t.Fatal(err)
383 }
384 dir := func(p ...string) string {
385 return filepath.Join(append([]string{srv.Root()}, p...)...)
386 }
387
388 // Setup the dependent chart
389 d := &chart.Chart{
390 Metadata: &chart.Metadata{
391 Name: "dep-chart",
392 Version: "0.1.0",
393 APIVersion: "v1",
394 },
395 }
396
397 // Save a chart with the dependency
398 c := &chart.Chart{
399 Metadata: &chart.Metadata{
400 Name: "with-dependency",
401 Version: "0.1.0",
402 APIVersion: "v2",
403 Dependencies: []*chart.Dependency{{
404 Name: d.Metadata.Name,
405 Version: "0.1.0",
406 }},
407 },
408 }
409 if err := chartutil.SaveDir(c, dir()); err != nil {
410 t.Fatal(err)
411 }
412
413 // Save dependent chart into the parents charts directory. If the chart is
414 // not in the charts directory Helm will return an error that it is not
415 // found.
416 if err := chartutil.SaveDir(d, dir(c.Metadata.Name, "charts")); err != nil {
417 t.Fatal(err)
418 }
419
420 // Set-up a manager
421 b := bytes.NewBuffer(nil)
422 g := getter.Providers{getter.Provider{
423 Schemes: []string{"http", "https"},
424 New: getter.NewHTTPGetter,
425 }}
426 m := &Manager{
427 ChartPath: dir(c.Metadata.Name),
428 Out: b,
429 Getters: g,
430 RepositoryConfig: dir("repositories.yaml"),
431 RepositoryCache: dir(),

Callers

nothing calls this directly

Calls 7

UpdateMethod · 0.95
NewTempServerFunction · 0.92
WithChartSourceGlobFunction · 0.92
StopMethod · 0.80
LinkIndicesMethod · 0.80
FatalMethod · 0.80
RootMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…