Skip to content

Commit

Permalink
Fix node end point test that was failing compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
preetapan committed Oct 30, 2017
1 parent e8d9178 commit cf817c8
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions nomad/node_endpoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1365,8 +1365,30 @@ func TestClientEndpoint_GetClientAllocs_Blocking(t *testing.T) {
t.Fatalf("bad: %#v", resp2.Allocs)
}

if resp2.Allocs[0].ModifyTime != now {
t.Fatalf("Invalid modify time %v", resp2.Allocs[0].ModifyTime)
iter, err := state.AllocsByIDPrefix(nil, structs.DefaultNamespace, alloc.ID)
if err != nil {
t.Fatalf("err: %v", err)
}

getAllocs := func(iter memdb.ResultIterator) []*structs.Allocation {
var allocs []*structs.Allocation
for {
raw := iter.Next()
if raw == nil {
break
}
allocs = append(allocs, raw.(*structs.Allocation))
}
return allocs
}
out := getAllocs(iter)

if len(out) != 1 {
t.Fatalf("Expected to get one allocation but got:%v", out)
}

if out[0].ModifyTime != now {
t.Fatalf("Invalid modify time %v", out[0].ModifyTime)
}

// Alloc updates fire watches
Expand Down

0 comments on commit cf817c8

Please sign in to comment.