|
|
|
@ -19,7 +19,6 @@ package engine
|
|
|
|
|
import (
|
|
|
|
|
"fmt"
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
|
"helm.sh/helm/v4/pkg/chart/v2/loader"
|
|
|
|
|
"path"
|
|
|
|
|
"strings"
|
|
|
|
|
"sync"
|
|
|
|
@ -1303,23 +1302,34 @@ func TestRenderTplMissingKeyString(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestSometimesJesseJustBe(t *testing.T) {
|
|
|
|
|
c, _ := loader.Load("/home/jesse/code/camunda-platform-helm/charts/camunda-platform-8.5")
|
|
|
|
|
func TestNestedHelpersProducesMultilineStacktrace(t *testing.T) {
|
|
|
|
|
c := &chart.Chart{
|
|
|
|
|
Metadata: &chart.Metadata{Name: "NestedHelperFunctions"},
|
|
|
|
|
Templates: []*chart.File{
|
|
|
|
|
{Name: "templates/svc.yaml", Data: []byte(
|
|
|
|
|
`name: {{ include "nested_helper.name" . }}`,
|
|
|
|
|
)},
|
|
|
|
|
{Name: "templates/_helpers_1.tpl", Data: []byte(
|
|
|
|
|
`{{- define "nested_helper.name" -}}{{- include "common.names.get_name" . -}}{{- end -}}`,
|
|
|
|
|
)},
|
|
|
|
|
{Name: "charts/common/templates/_helpers_2.tpl", Data: []byte(
|
|
|
|
|
`{{- define "common.names.get_name" -}}{{- .Release.Name | trunc 63 | trimSuffix "-" -}}{{- end -}}`,
|
|
|
|
|
)},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
v := chartutil.Values{}
|
|
|
|
|
|
|
|
|
|
v, _ := chartutil.ReadValuesFile("/home/jesse/code/helm/values.yaml")
|
|
|
|
|
val, _ := chartutil.CoalesceValues(c, v)
|
|
|
|
|
vals := map[string]interface{}{
|
|
|
|
|
"Values": val.AsMap(),
|
|
|
|
|
}
|
|
|
|
|
out, err := Render(c, vals)
|
|
|
|
|
_, err := Render(c, vals)
|
|
|
|
|
|
|
|
|
|
assert.NotNil(t, err)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Errorf("Failed to render templates: %s", err)
|
|
|
|
|
}
|
|
|
|
|
assert.NotNil(t, out)
|
|
|
|
|
data := strings.TrimSpace(out["jesse-subchart-values-hacktest/charts/keycloak/templates/ingress.yaml"])
|
|
|
|
|
fmt.Println(data)
|
|
|
|
|
assert.NotEmpty(t, data)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRenderCustomTemplateFuncs(t *testing.T) {
|
|
|
|
|