schedule: avoid in-place update of task if network resources are different

This commit is contained in:
Armon Dadgar
2015-09-13 16:41:53 -07:00
parent cceea396f6
commit 65cd3b4ca7
2 changed files with 11 additions and 0 deletions

View File

@@ -227,6 +227,11 @@ func tasksUpdated(a, b *structs.TaskGroup) bool {
if !reflect.DeepEqual(at.Config, bt.Config) {
return true
}
// Inspect the network to see if the resource ask is different
if !reflect.DeepEqual(at.Resources.Networks, bt.Resources.Networks) {
return true
}
}
return false
}

View File

@@ -259,4 +259,10 @@ func TestTasksUpdated(t *testing.T) {
if !tasksUpdated(j1.TaskGroups[0], j5.TaskGroups[0]) {
t.Fatalf("bad")
}
j6 := mock.Job()
j6.TaskGroups[0].Tasks[0].Resources.Networks[0].DynamicPorts = 3
if !tasksUpdated(j1.TaskGroups[0], j6.TaskGroups[0]) {
t.Fatalf("bad")
}
}