diff --git a/go.mod b/go.mod index 78f7d1bd6..0d67740be 100644 --- a/go.mod +++ b/go.mod @@ -36,6 +36,7 @@ require ( github.com/stretchr/testify v1.6.1 github.com/xeipuuv/gojsonschema v1.2.0 golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 + gopkg.in/yaml.v2 v2.3.0 // indirect k8s.io/api v0.19.2 k8s.io/apiextensions-apiserver v0.19.2 k8s.io/apimachinery v0.19.2 diff --git a/pkg/engine/funcs_test.go b/pkg/engine/funcs_test.go index 62c63ec2b..9874f032c 100644 --- a/pkg/engine/funcs_test.go +++ b/pkg/engine/funcs_test.go @@ -94,6 +94,10 @@ func TestFuncs(t *testing.T) { tpl: `{{ fromYamlArray . }}`, expect: `[error unmarshaling JSON: while decoding JSON: json: cannot unmarshal object into Go value of type []interface {}]`, vars: `hello: world`, + }, { + tpl: `{{ toYaml . }}`, + expect: `foo: this string needs to be more than 80 characters in order to trigger the wrapping behavior in gopkg.in/yaml.v2 <= 2.2.8`, + vars: map[string]interface{}{"foo": "this string needs to be more than 80 characters in order to trigger the wrapping behavior in gopkg.in/yaml.v2 <= 2.2.8"}, }, { // This should never result in a network lookup. Regression for #7955 tpl: `{{ lookup "v1" "Namespace" "" "unlikelynamespace99999999" }}`,