Minor test race fix

This commit is contained in:
Michael Schurter 2017-07-21 16:17:23 -07:00
parent 9a7a1d8c13
commit a22cfa8387
1 changed files with 3 additions and 2 deletions

View File

@ -559,6 +559,9 @@ func TestAllocRunner_Destroy(t *testing.T) {
func TestAllocRunner_Update(t *testing.T) {
_, ar := testAllocRunner(false)
// Deep copy the alloc to avoid races when updating
newAlloc := ar.Alloc().Copy()
// Ensure task takes some time
task := ar.alloc.Job.TaskGroups[0].Tasks[0]
task.Driver = "mock_driver"
@ -567,8 +570,6 @@ func TestAllocRunner_Update(t *testing.T) {
defer ar.Destroy()
// Update the alloc definition
newAlloc := new(structs.Allocation)
*newAlloc = *ar.alloc
newAlloc.Name = "FOO"
newAlloc.AllocModifyIndex++
ar.Update(newAlloc)