change the way finding the just built compose binary

Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
This commit is contained in:
Guillaume Lours 2022-12-21 19:27:03 +01:00
parent 86a648bd51
commit c72f161afb
No known key found for this signature in database

View File

@ -134,8 +134,8 @@ func initializePlugins(t testing.TB, configDir string) {
require.NoError(t, os.MkdirAll(filepath.Join(configDir, "cli-plugins"), 0o755), require.NoError(t, os.MkdirAll(filepath.Join(configDir, "cli-plugins"), 0o755),
"Failed to create cli-plugins directory") "Failed to create cli-plugins directory")
composePlugin, err := findExecutable(DockerComposeExecutableName) composePlugin, err := findExecutable(DockerComposeExecutableName)
if os.IsNotExist(err) { if err != nil {
t.Logf("WARNING: docker-compose cli-plugin not found") t.Errorf("WARNING: docker-compose cli-plugin not found %s", err.Error())
} }
buildxPlugin, err := findPluginExecutable(DockerBuildxExecutableName) buildxPlugin, err := findPluginExecutable(DockerBuildxExecutableName)
if os.IsNotExist(err) { if os.IsNotExist(err) {
@ -159,8 +159,11 @@ func dirContents(dir string) []string {
} }
func findExecutable(executableName string) (string, error) { func findExecutable(executableName string) (string, error) {
_, filename, _, _ := runtime.Caller(0) filename, err := os.Getwd()
root := filepath.Join(filepath.Dir(filename), "..", "..") if err != nil {
return "", err
}
root := filepath.Join(filepath.Dir(filename), "..")
buildPath := filepath.Join(root, "bin", "build") buildPath := filepath.Join(root, "bin", "build")
bin, err := filepath.Abs(filepath.Join(buildPath, executableName)) bin, err := filepath.Abs(filepath.Join(buildPath, executableName))