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:
parent
614f63f40d
commit
b7d421a149
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue