mirror of
https://github.com/kemko/nomad.git
synced 2026-01-03 17:05:43 +03:00
Merge pull request #5216 from hashicorp/b-fix-tests-20180118
tests: deflake client TestFS_Logs_TaskPending test
This commit is contained in:
@@ -891,7 +891,7 @@ func TestFS_Logs_TaskPending(t *testing.T) {
|
||||
job := mock.BatchJob()
|
||||
job.TaskGroups[0].Count = 1
|
||||
job.TaskGroups[0].Tasks[0].Config = map[string]interface{}{
|
||||
"start_block_for": "4s",
|
||||
"start_block_for": "10s",
|
||||
}
|
||||
|
||||
// Register job
|
||||
@@ -916,6 +916,12 @@ func TestFS_Logs_TaskPending(t *testing.T) {
|
||||
}
|
||||
|
||||
allocID = resp.Allocations[0].ID
|
||||
|
||||
// wait for alloc runner to be created; otherwise, we get no alloc found error
|
||||
if _, err := c.getAllocRunner(allocID); err != nil {
|
||||
return false, fmt.Errorf("alloc runner was not created yet for %v", allocID)
|
||||
}
|
||||
|
||||
return true, nil
|
||||
}, func(err error) {
|
||||
t.Fatalf("error getting alloc id: %v", err)
|
||||
|
||||
@@ -455,7 +455,19 @@ func TestClientAllocations_GarbageCollect_Remote(t *testing.T) {
|
||||
}
|
||||
testutil.WaitForResult(func() (bool, error) {
|
||||
nodes := s2.connectedNodes()
|
||||
return len(nodes) == 1, nil
|
||||
if len(nodes) != 1 {
|
||||
return false, fmt.Errorf("should have 1 client. found %d", len(nodes))
|
||||
}
|
||||
req := &structs.NodeSpecificRequest{
|
||||
NodeID: c.NodeID(),
|
||||
QueryOptions: structs.QueryOptions{Region: "global"},
|
||||
}
|
||||
resp := structs.SingleNodeResponse{}
|
||||
if err := msgpackrpc.CallWithCodec(codec, "Node.GetNode", req, &resp); err != nil {
|
||||
return false, err
|
||||
}
|
||||
return resp.Node != nil && resp.Node.Status == structs.NodeStatusReady, fmt.Errorf(
|
||||
"expected ready but found %s", pretty.Sprint(resp.Node))
|
||||
}, func(err error) {
|
||||
t.Fatalf("should have a clients")
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user