Fix Testutil for delve debugging API tests (#13589)

This commit is contained in:
Charlie Voiselle
2022-07-06 10:47:48 -04:00
committed by GitHub
parent 11cb4c6d82
commit b5046dfdc2
2 changed files with 15 additions and 7 deletions

View File

@@ -59,8 +59,17 @@ func NomadExecutable() (string, error) {
}
func isNomad(path, nomadExe string) bool {
if strings.HasSuffix(path, ".test") || strings.HasSuffix(path, ".test.exe") {
switch {
case strings.HasSuffix(path, ".test"):
return false
case strings.HasSuffix(path, ".test.exe"):
return false
// delve debug executable for debugging test
case strings.HasSuffix(path, "__debug_bin"):
return false
case strings.HasSuffix(path, "__debug_bin.exe"):
return false
default:
return true
}
return true
}

View File

@@ -155,11 +155,10 @@ func NewTestServer(t testing.T, cb ServerConfigCallback) *TestServer {
}
// Check that we are actually running nomad
vcmd := exec.Command(path, "-version")
vcmd.Stdout = nil
vcmd.Stderr = nil
if err := vcmd.Run(); err != nil {
t.Skipf("nomad version failed: %v", err)
if out, err := exec.Command(path, "-version").CombinedOutput(); err != nil {
t.Logf("nomad version failed: %v", err)
t.Logf("nomad version output:\n%s", string(out))
t.Skip()
}
dataDir, err := ioutil.TempDir("", "nomad")