2021-04-17 16:43:17 +05:30
|
|
|
Description: Search for gitlab-workhorse binaries also in the environment in PATH variable
|
|
|
|
Author: Nilesh Patra <npatra974@gmail.com>
|
|
|
|
Last-Update: 2021-01-26
|
|
|
|
--- a/workhorse/internal/testhelper/testhelper.go
|
|
|
|
+++ b/workhorse/internal/testhelper/testhelper.go
|
2022-07-29 18:21:45 +05:30
|
|
|
@@ -12,6 +12,7 @@
|
2021-04-17 16:43:17 +05:30
|
|
|
"runtime"
|
|
|
|
"testing"
|
|
|
|
"time"
|
|
|
|
+ "os/exec"
|
|
|
|
|
2021-11-11 17:04:58 +05:30
|
|
|
"github.com/golang-jwt/jwt/v4"
|
2021-04-17 16:43:17 +05:30
|
|
|
"github.com/stretchr/testify/require"
|
2022-07-29 18:21:45 +05:30
|
|
|
@@ -96,8 +97,11 @@
|
2021-04-17 16:43:17 +05:30
|
|
|
rootDir := RootDir()
|
|
|
|
|
|
|
|
for _, exe := range workhorseExecutables {
|
|
|
|
- if _, err := os.Stat(path.Join(rootDir, exe)); os.IsNotExist(err) {
|
|
|
|
- return fmt.Errorf("cannot find executable %s. Please run 'make prepare-tests'", exe)
|
|
|
|
+ _, err := exec.LookPath(exe)
|
|
|
|
+ if err != nil {
|
|
|
|
+ if _, rootdirerr := os.Stat(path.Join(rootDir, exe)); os.IsNotExist(rootdirerr) {
|
|
|
|
+ return fmt.Errorf("cannot find executable %s. Please run 'make prepare-tests'", exe)
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|