MCPcopy
hub / github.com/helm/helm / TestLoadValues

Function TestLoadValues

internal/chart/v3/loader/load_test.go:455–507  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

453}
454
455func TestLoadValues(t *testing.T) {
456 testCases := map[string]struct {
457 data []byte
458 expctedValues map[string]any
459 }{
460 "It should load values correctly": {
461 data: []byte(`
462foo:
463 image: foo:v1
464bar:
465 version: v2
466`),
467 expctedValues: map[string]any{
468 "foo": map[string]any{
469 "image": "foo:v1",
470 },
471 "bar": map[string]any{
472 "version": "v2",
473 },
474 },
475 },
476 "It should load values correctly with multiple documents in one file": {
477 data: []byte(`
478foo:
479 image: foo:v1
480bar:
481 version: v2
482---
483foo:
484 image: foo:v2
485`),
486 expctedValues: map[string]any{
487 "foo": map[string]any{
488 "image": "foo:v2",
489 },
490 "bar": map[string]any{
491 "version": "v2",
492 },
493 },
494 },
495 }
496 for testName, testCase := range testCases {
497 t.Run(testName, func(tt *testing.T) {
498 values, err := LoadValues(bytes.NewReader(testCase.data))
499 if err != nil {
500 tt.Fatal(err)
501 }
502 if !reflect.DeepEqual(values, testCase.expctedValues) {
503 tt.Errorf("Expected values: %v, got %v", testCase.expctedValues, values)
504 }
505 })
506 }
507}
508
509func TestMergeValuesV3(t *testing.T) {
510 nestedMap := map[string]any{

Callers

nothing calls this directly

Calls 3

FatalMethod · 0.80
LoadValuesFunction · 0.70
RunMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…