skip running test executables

This commit is contained in:
Alex Dadgar
2017-10-18 15:35:31 -07:00
parent 651159077b
commit 43764fdeec
3 changed files with 8 additions and 23 deletions

View File

@@ -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
}

View File

@@ -1,7 +0,0 @@
// +build !nomad_test
package discover
func isNomad(path, nomadExe string) bool {
return true
}

View File

@@ -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
}