darwin test fixes

This commit is contained in:
Alex Dadgar 2017-07-22 19:27:20 -07:00
parent b6f0782732
commit d760e68774
4 changed files with 15 additions and 6 deletions

View File

@ -371,8 +371,10 @@ func TestAllocDir_SplitPath(t *testing.T) {
if err != nil {
t.Fatalf("err: %v", err)
}
if len(info) != 6 {
t.Fatalf("expected: %v, actual: %v", 6, len(info))
// Testing that is 6 or more rather than 6 because on osx, the temp dir is
// randomized.
if len(info) < 6 {
t.Fatalf("expected more than: %v, actual: %v", 6, len(info))
}
}

View File

@ -81,7 +81,7 @@ func TestExecutor_Start_Invalid(t *testing.T) {
func TestExecutor_Start_Wait_Failure_Code(t *testing.T) {
t.Parallel()
execCmd := ExecCommand{Cmd: "/bin/sleep", Args: []string{"fail"}}
execCmd := ExecCommand{Cmd: "/bin/date", Args: []string{"fail"}}
ctx, allocDir := testExecutorContext(t)
defer allocDir.Destroy()
executor := NewExecutor(log.New(os.Stdout, "", log.LstdFlags))
@ -163,13 +163,13 @@ func TestExecutor_WaitExitSignal(t *testing.T) {
}
go func() {
time.Sleep(3 * time.Second)
time.Sleep(2 * time.Second)
ru, err := executor.Stats()
if err != nil {
t.Fatalf("err: %v", err)
}
if len(ru.Pids) != 2 {
t.Fatalf("expected number of pids: 2, actual: %v", len(ru.Pids))
if len(ru.Pids) == 0 {
t.Fatalf("expected pids")
}
proc, err := os.FindProcess(ps.Pid)
if err != nil {

View File

@ -310,6 +310,9 @@ func TestJavaDriverUser(t *testing.T) {
if !javaLocated() {
t.Skip("Java not found; skipping")
}
if runtime.GOOS != "linux" {
t.Skip("Linux only test")
}
ctestutils.JavaCompatible(t)
task := &structs.Task{

View File

@ -7,6 +7,7 @@ import (
"io/ioutil"
"path/filepath"
"reflect"
"runtime"
"strings"
"testing"
"time"
@ -261,6 +262,9 @@ func TestRawExecDriver_Start_Kill_Wait(t *testing.T) {
func TestRawExecDriverUser(t *testing.T) {
t.Parallel()
if runtime.GOOS != "linux" {
t.Skip("Linux only test")
}
task := &structs.Task{
Name: "sleep",
Driver: "raw_exec",