mirror of
https://github.com/kemko/nomad.git
synced 2026-01-10 20:35:42 +03:00
tests: WaitForRunning checks for pending only
WaitForRunning risks a race condition where the allocation succeeds and completes before WaitForRunning is called (or while it is running). Here, I made the behavior match the function documentation. I considered making it stricter, but callers need to account for allocation terminating immediately after WaitForRunning terminates anyway.
This commit is contained in:
@@ -123,7 +123,7 @@ func WaitForRunning(t testing.T, rpc rpcFn, job *structs.Job) []*structs.AllocLi
|
||||
}
|
||||
|
||||
for _, alloc := range resp.Allocations {
|
||||
if alloc.ClientStatus != structs.AllocClientStatusRunning {
|
||||
if alloc.ClientStatus == structs.AllocClientStatusPending {
|
||||
return false, fmt.Errorf("alloc not running: id=%v tg=%v status=%v",
|
||||
alloc.ID, alloc.TaskGroup, alloc.ClientStatus)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user