Improve plugin home defaulting.

This commit is contained in:
jregan
2019-11-03 10:04:45 -08:00
parent ba925e833d
commit d08690a6aa
11 changed files with 263 additions and 67 deletions

View File

@@ -40,8 +40,11 @@ func NewKustTestHarness(t *testing.T, path string) *KustTestHarness {
}
func NewKustTestHarnessAllowPlugins(t *testing.T, path string) *KustTestHarness {
return NewKustTestHarnessFull(
t, path, fLdr.RestrictionRootOnly, pgmconfig.EnabledPluginConfig())
c, err := pgmconfig.EnabledPluginConfig()
if err != nil {
t.Fatal(err)
}
return NewKustTestHarnessFull(t, path, fLdr.RestrictionRootOnly, c)
}
func NewKustTestHarnessNoLoadRestrictor(t *testing.T, path string) *KustTestHarness {
@@ -100,7 +103,10 @@ func (th *KustTestHarness) FromMap(m map[string]interface{}) *resource.Resource
return th.rf.RF().FromMap(m)
}
func (th *KustTestHarness) FromMapAndOption(m map[string]interface{}, args *types.GeneratorArgs, option *types.GeneratorOptions) *resource.Resource {
func (th *KustTestHarness) FromMapAndOption(
m map[string]interface{},
args *types.GeneratorArgs,
option *types.GeneratorOptions) *resource.Resource {
return th.rf.RF().FromMapAndOption(m, args, option)
}

View File

@@ -11,6 +11,7 @@ import (
"strings"
"testing"
"sigs.k8s.io/kustomize/api/filesys"
"sigs.k8s.io/kustomize/api/pgmconfig"
"sigs.k8s.io/kustomize/api/plugins/compiler"
)
@@ -75,7 +76,7 @@ func (x *PluginTestEnv) makeCompiler() *compiler.Compiler {
if err != nil {
x.t.Error(err)
}
srcRoot, err := compiler.DefaultSrcRoot()
srcRoot, err := compiler.DefaultSrcRoot(filesys.MakeFsOnDisk())
if err != nil {
x.t.Error(err)
}