test: copy AR's Alloc before mutating

Fixes a race in client tests
This commit is contained in:
Michael Schurter 2018-12-19 15:42:49 -08:00
parent 17ed3f27ae
commit add2dd8c2d

View file

@ -30,7 +30,7 @@ func gcConfig() *GCConfig {
// runners to be terminal // runners to be terminal
func exitAllocRunner(runners ...AllocRunner) { func exitAllocRunner(runners ...AllocRunner) {
for _, ar := range runners { for _, ar := range runners {
terminalAlloc := ar.Alloc() terminalAlloc := ar.Alloc().Copy()
terminalAlloc.DesiredStatus = structs.AllocDesiredStatusStop terminalAlloc.DesiredStatus = structs.AllocDesiredStatusStop
ar.Update(terminalAlloc) ar.Update(terminalAlloc)
} }