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)
| 372 | // This happens when the dependency is in the charts directory and does not need |
| 373 | // to be fetched. |
| 374 | func 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(), |
nothing calls this directly
no test coverage detected
searching dependent graphs…