mirror of
https://github.com/kemko/nomad.git
synced 2026-01-01 16:05:42 +03:00
skip running test executables
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Checks the current executable, then $GOPATH/bin, and finally the CWD, in that
|
||||
@@ -56,3 +57,10 @@ func NomadExecutable() (string, error) {
|
||||
|
||||
return "", fmt.Errorf("Could not find Nomad executable (%v)", nomadExe)
|
||||
}
|
||||
|
||||
func isNomad(path, nomadExe string) bool {
|
||||
if strings.HasSuffix(path, ".test") || strings.HasSuffix(path, ".test.exe") {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
// +build !nomad_test
|
||||
|
||||
package discover
|
||||
|
||||
func isNomad(path, nomadExe string) bool {
|
||||
return true
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
// +build nomad_test
|
||||
|
||||
package discover
|
||||
|
||||
import "path/filepath"
|
||||
|
||||
// When running tests we do not want to return the test binary that is running
|
||||
// so we filter it and force discovery via the other mechanisms. Any test that
|
||||
// fork/execs Nomad should be run with `-tags nomad_test`.
|
||||
func isNomad(path, nomadExe string) bool {
|
||||
if filepath.Base(path) == nomadExe {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
Reference in New Issue
Block a user