mirror of
https://github.com/kemko/nomad.git
synced 2026-01-05 01:45:44 +03:00
Fix tests
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
@@ -49,10 +50,13 @@ func TestAllocRunner_SimpleRun(t *testing.T) {
|
||||
|
||||
testutil.WaitForResult(func() (bool, error) {
|
||||
if upd.Count == 0 {
|
||||
return false, nil
|
||||
return false, fmt.Errorf("No updates")
|
||||
}
|
||||
last := upd.Allocs[upd.Count-1]
|
||||
return last.ClientStatus == structs.AllocClientStatusDead, nil
|
||||
if last.ClientStatus == structs.AllocClientStatusDead {
|
||||
return false, fmt.Errorf("got status %v; want %v", last.ClientStatus, structs.AllocClientStatusDead)
|
||||
}
|
||||
return true, nil
|
||||
}, func(err error) {
|
||||
t.Fatalf("err: %v", err)
|
||||
})
|
||||
|
||||
@@ -131,7 +131,7 @@ func TestTaskRunner_Update(t *testing.T) {
|
||||
|
||||
// Change command to ensure we run for a bit
|
||||
tr.task.Config["command"] = "/bin/sleep"
|
||||
tr.task.Config["args"] = []string{"10"}
|
||||
tr.task.Config["args"] = []string{"100"}
|
||||
go tr.Run()
|
||||
defer tr.Destroy()
|
||||
defer tr.ctx.AllocDir.Destroy()
|
||||
@@ -148,6 +148,15 @@ func TestTaskRunner_Update(t *testing.T) {
|
||||
newTask.Driver = "foobar"
|
||||
|
||||
// Update the kill timeout
|
||||
testutil.WaitForResult(func() (bool, error) {
|
||||
if tr.handle == nil {
|
||||
return false, fmt.Errorf("task not started")
|
||||
}
|
||||
return true, nil
|
||||
}, func(err error) {
|
||||
t.Fatalf("err: %v", err)
|
||||
})
|
||||
|
||||
oldHandle := tr.handle.ID()
|
||||
newTask.KillTimeout = time.Hour
|
||||
|
||||
|
||||
Reference in New Issue
Block a user