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

Function TestLoadValues

pkg/chart/v2/loader/load_test.go:508–560  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

506}
507
508func TestLoadValues(t *testing.T) {
509 testCases := map[string]struct {
510 data []byte
511 expctedValues map[string]any
512 }{
513 "It should load values correctly": {
514 data: []byte(`
515foo:
516 image: foo:v1
517bar:
518 version: v2
519`),
520 expctedValues: map[string]any{
521 "foo": map[string]any{
522 "image": "foo:v1",
523 },
524 "bar": map[string]any{
525 "version": "v2",
526 },
527 },
528 },
529 "It should load values correctly with multiple documents in one file": {
530 data: []byte(`
531foo:
532 image: foo:v1
533bar:
534 version: v2
535---
536foo:
537 image: foo:v2
538`),
539 expctedValues: map[string]any{
540 "foo": map[string]any{
541 "image": "foo:v2",
542 },
543 "bar": map[string]any{
544 "version": "v2",
545 },
546 },
547 },
548 }
549 for testName, testCase := range testCases {
550 t.Run(testName, func(tt *testing.T) {
551 values, err := LoadValues(bytes.NewReader(testCase.data))
552 if err != nil {
553 tt.Fatal(err)
554 }
555 if !reflect.DeepEqual(values, testCase.expctedValues) {
556 tt.Errorf("Expected values: %v, got %v", testCase.expctedValues, values)
557 }
558 })
559 }
560}
561
562func TestMergeValuesV2(t *testing.T) {
563 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…