Make GetOpenAPIFile publicly settable

This commit is contained in:
Phillip Wittrock
2020-02-20 21:43:55 -08:00
parent ca9aa62c26
commit e004c31700
9 changed files with 36 additions and 13 deletions

View File

@@ -11,6 +11,7 @@ import (
"testing"
"github.com/stretchr/testify/assert"
"sigs.k8s.io/kustomize/cmd/config/ext"
"sigs.k8s.io/kustomize/cmd/config/internal/commands"
"sigs.k8s.io/kustomize/kyaml/openapi"
)
@@ -224,7 +225,9 @@ spec:
if !assert.NoError(t, err) {
t.FailNow()
}
commands.GetOpenAPIFile = func(args []string) (s string, err error) {
old := ext.GetOpenAPIFile
defer func() { ext.GetOpenAPIFile = old }()
ext.GetOpenAPIFile = func(args []string) (s string, err error) {
return f.Name(), nil
}