(t *testing.T)
| 25 | ) |
| 26 | |
| 27 | func TestToRenderValues(t *testing.T) { |
| 28 | |
| 29 | chartValues := map[string]any{ |
| 30 | "name": "al Rashid", |
| 31 | "where": map[string]any{ |
| 32 | "city": "Basrah", |
| 33 | "title": "caliph", |
| 34 | }, |
| 35 | } |
| 36 | |
| 37 | overrideValues := map[string]any{ |
| 38 | "name": "Haroun", |
| 39 | "where": map[string]any{ |
| 40 | "city": "Baghdad", |
| 41 | "date": "809 CE", |
| 42 | }, |
| 43 | } |
| 44 | |
| 45 | c := &chart.Chart{ |
| 46 | Metadata: &chart.Metadata{Name: "test"}, |
| 47 | Templates: []*common.File{}, |
| 48 | Values: chartValues, |
| 49 | Files: []*common.File{ |
| 50 | {Name: "scheherazade/shahryar.txt", ModTime: time.Now(), Data: []byte("1,001 Nights")}, |
| 51 | }, |
| 52 | } |
| 53 | c.AddDependency(&chart.Chart{ |
| 54 | Metadata: &chart.Metadata{Name: "where"}, |
| 55 | }) |
| 56 | |
| 57 | o := common.ReleaseOptions{ |
| 58 | Name: "Seven Voyages", |
| 59 | Namespace: "default", |
| 60 | Revision: 1, |
| 61 | IsInstall: true, |
| 62 | } |
| 63 | |
| 64 | res, err := ToRenderValuesWithSchemaValidation(c, overrideValues, o, nil, false) |
| 65 | if err != nil { |
| 66 | t.Fatal(err) |
| 67 | } |
| 68 | |
| 69 | // Ensure that the top-level values are all set. |
| 70 | metamap := res["Chart"].(map[string]any) |
| 71 | if name := metamap["Name"]; name.(string) != "test" { |
| 72 | t.Errorf("Expected chart name 'test', got %q", name) |
| 73 | } |
| 74 | relmap := res["Release"].(map[string]any) |
| 75 | if name := relmap["Name"]; name.(string) != "Seven Voyages" { |
| 76 | t.Errorf("Expected release name 'Seven Voyages', got %q", name) |
| 77 | } |
| 78 | if namespace := relmap["Namespace"]; namespace.(string) != "default" { |
| 79 | t.Errorf("Expected namespace 'default', got %q", namespace) |
| 80 | } |
| 81 | if revision := relmap["Revision"]; revision.(int) != 1 { |
| 82 | t.Errorf("Expected revision '1', got %d", revision) |
| 83 | } |
| 84 | if relmap["IsUpgrade"].(bool) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…