diff --git a/helper/discover/discover.go b/helper/discover/discover.go index 018480610..f385c3c25 100644 --- a/helper/discover/discover.go +++ b/helper/discover/discover.go @@ -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 +} diff --git a/helper/discover/discover_generic.go b/helper/discover/discover_generic.go deleted file mode 100644 index 3d94572dd..000000000 --- a/helper/discover/discover_generic.go +++ /dev/null @@ -1,7 +0,0 @@ -// +build !nomad_test - -package discover - -func isNomad(path, nomadExe string) bool { - return true -} diff --git a/helper/discover/discover_nomad_testing.go b/helper/discover/discover_nomad_testing.go deleted file mode 100644 index 581fea0d5..000000000 --- a/helper/discover/discover_nomad_testing.go +++ /dev/null @@ -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 -}