mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-11 00:52:55 +00:00
Merge pull request #2530 from monopole/deleteRace
Remove race in tests.
This commit is contained in:
@@ -55,12 +55,6 @@ func (b *Compiler) ObjPath() string {
|
|||||||
return filepath.Join(b.workDir, b.objFile())
|
return filepath.Join(b.workDir, b.objFile())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cleanup provides a hook to delete the .so file.
|
|
||||||
// Ignore errors.
|
|
||||||
func (b *Compiler) Cleanup() {
|
|
||||||
_ = os.Remove(b.ObjPath())
|
|
||||||
}
|
|
||||||
|
|
||||||
// Compile changes its working directory to
|
// Compile changes its working directory to
|
||||||
// ${pluginRoot}/${g}/${v}/$lower(${k} and places
|
// ${pluginRoot}/${g}/${v}/$lower(${k} and places
|
||||||
// object code next to source code.
|
// object code next to source code.
|
||||||
@@ -98,7 +92,7 @@ func (b *Compiler) Compile() error {
|
|||||||
}
|
}
|
||||||
result := filepath.Join(b.workDir, b.objFile())
|
result := filepath.Join(b.workDir, b.objFile())
|
||||||
if utils.FileExists(result) {
|
if utils.FileExists(result) {
|
||||||
log.Printf("Created %s", result)
|
log.Printf("compiler created: %s", result)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return fmt.Errorf("post compile, cannot find '%s'", result)
|
return fmt.Errorf("post compile, cannot find '%s'", result)
|
||||||
|
|||||||
@@ -33,10 +33,6 @@ func TestCompiler(t *testing.T) {
|
|||||||
if !utils.FileExists(expectObj) {
|
if !utils.FileExists(expectObj) {
|
||||||
t.Errorf("didn't find expected obj file %s", expectObj)
|
t.Errorf("didn't find expected obj file %s", expectObj)
|
||||||
}
|
}
|
||||||
c.Cleanup()
|
|
||||||
if utils.FileExists(expectObj) {
|
|
||||||
t.Errorf("obj file '%s' should be gone", expectObj)
|
|
||||||
}
|
|
||||||
|
|
||||||
c.SetGVK("builtin", "", "SecretGenerator")
|
c.SetGVK("builtin", "", "SecretGenerator")
|
||||||
expectObj = filepath.Join(
|
expectObj = filepath.Join(
|
||||||
@@ -52,8 +48,4 @@ func TestCompiler(t *testing.T) {
|
|||||||
if !utils.FileExists(expectObj) {
|
if !utils.FileExists(expectObj) {
|
||||||
t.Errorf("didn't find expected obj file %s", expectObj)
|
t.Errorf("didn't find expected obj file %s", expectObj)
|
||||||
}
|
}
|
||||||
c.Cleanup()
|
|
||||||
if utils.FileExists(expectObj) {
|
|
||||||
t.Errorf("obj file '%s' should be gone", expectObj)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -206,7 +206,8 @@ func (l *Loader) loadGoPlugin(id resid.ResId) (resmap.Configurable, error) {
|
|||||||
}
|
}
|
||||||
absPath := l.absolutePluginPath(id) + ".so"
|
absPath := l.absolutePluginPath(id) + ".so"
|
||||||
if !utils.FileExists(absPath) {
|
if !utils.FileExists(absPath) {
|
||||||
return nil, fmt.Errorf("cannot find Go object code '%s'", absPath)
|
return nil, fmt.Errorf(
|
||||||
|
"expected file with Go object code at: %s", absPath)
|
||||||
}
|
}
|
||||||
log.Printf("Attempting plugin load from '%s'", absPath)
|
log.Printf("Attempting plugin load from '%s'", absPath)
|
||||||
p, err := plugin.Open(absPath)
|
p, err := plugin.Open(absPath)
|
||||||
|
|||||||
Reference in New Issue
Block a user