Test rendering a valid Helm chart with no subcharts and three templates
(t *testing.T)
| 11 | |
| 12 | // Test rendering a valid Helm chart with no subcharts and three templates |
| 13 | func TestRenderHelmChart_Valid(t *testing.T) { |
| 14 | var opt chartutil.ReleaseOptions |
| 15 | |
| 16 | manifestFiles, err := RenderHelmChart(false, consts.ChartPath, opt) |
| 17 | assert.Nil(t, err) |
| 18 | |
| 19 | // Check that the output directory exists and contains expected files |
| 20 | expectedFiles := make(map[string][]byte) |
| 21 | expectedFiles["deployment.yaml"] = getManifestAsBytes(t, "../tests/testmanifests/expecteddeployment.yaml") |
| 22 | expectedFiles["service.yaml"] = getManifestAsBytes(t, "../tests/testmanifests/expectedservice.yaml") |
| 23 | expectedFiles["ingress.yaml"] = getManifestAsBytes(t, "../tests/testmanifests/expectedingress.yaml") |
| 24 | |
| 25 | for i, writtenManifestFile := range manifestFiles { |
| 26 | writtenFileName := manifestFiles[i].Name |
| 27 | expectedYaml := bytes.TrimSpace(expectedFiles[writtenFileName]) |
| 28 | assert.Equal(t, bytes.TrimSpace(writtenManifestFile.ManifestContent), expectedYaml) |
| 29 | } |
| 30 | |
| 31 | // Test by giving file directly |
| 32 | manifestFiles, err = RenderHelmChart(true, consts.DirectPath_ToValidChart, opt) |
| 33 | assert.Nil(t, err) |
| 34 | |
| 35 | for i, writtenManifestFile := range manifestFiles { |
| 36 | writtenFileName := manifestFiles[i].Name |
| 37 | expectedYaml := bytes.TrimSpace(expectedFiles[writtenFileName]) |
| 38 | assert.Equal(t, bytes.TrimSpace(writtenManifestFile.ManifestContent), expectedYaml) |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | // Test rendering a valid Helm chart with no subcharts and three templates, using command line flags |
| 43 | func TestRenderHelmChartWithFlags_Valid(t *testing.T) { |
nothing calls this directly
no test coverage detected