diff --git a/pkg/kusttest/kusttestharness.go b/pkg/kusttest/kusttestharness.go index ac5445d39..7b2e49e36 100644 --- a/pkg/kusttest/kusttestharness.go +++ b/pkg/kusttest/kusttestharness.go @@ -31,16 +31,16 @@ type KustTestHarness struct { } func NewKustTestHarness(t *testing.T, path string) *KustTestHarness { - return NewKustTestHarnessWithPluginConfig( + return newHarness( t, path, plugins.DefaultPluginConfig()) } func NewKustTestPluginHarness(t *testing.T, path string) *KustTestHarness { - return NewKustTestHarnessWithPluginConfig( + return newHarness( t, path, plugins.ActivePluginConfig()) } -func NewKustTestHarnessWithPluginConfig( +func newHarness( t *testing.T, path string, pc *types.PluginConfig) *KustTestHarness { return NewKustTestHarnessFull(t, path, loader.RestrictionRootOnly, pc) diff --git a/pkg/plugins/compiler.go b/pkg/plugins/compiler.go index 9efd7c91e..a07dbd04a 100644 --- a/pkg/plugins/compiler.go +++ b/pkg/plugins/compiler.go @@ -41,7 +41,7 @@ type Compiler struct { } // DefaultSrcRoot guesses where the user -// has her ${g}/${v}/${k}.go files. +// has her ${g}/${v}/$lower(${k})/${k}.go files. func DefaultSrcRoot() (string, error) { var nope []string var root string @@ -109,8 +109,14 @@ func (b *Compiler) Compile(g, v, k string) error { } srcFile := filepath.Join(b.srcRoot, g, v, lowK, k) + ".go" if !FileExists(srcFile) { - return fmt.Errorf( - "cannot find source %s", srcFile) + // Handy for tests of lone plugins. + s := k + ".go" + if !FileExists(s) { + return fmt.Errorf( + "cannot find source at '%s' or '%s'", srcFile, s) + + } + srcFile = s } commands := []string{ "build",