Merge pull request #7414 from hashicorp/b-network-mode-change
Detect network mode change
This commit is contained in:
commit
6ddf3d1742
|
@ -437,6 +437,10 @@ func networkUpdated(netA, netB []*structs.NetworkResource) bool {
|
|||
an := netA[idx]
|
||||
bn := netB[idx]
|
||||
|
||||
if an.Mode != bn.Mode {
|
||||
return true
|
||||
}
|
||||
|
||||
if an.MBits != bn.MBits {
|
||||
return true
|
||||
}
|
||||
|
|
|
@ -675,6 +675,20 @@ func TestTasksUpdated(t *testing.T) {
|
|||
j18 := mock.Job()
|
||||
j18.Meta["j18_test"] = "roll_baby_roll"
|
||||
require.True(t, tasksUpdated(j1, j18, name))
|
||||
|
||||
// Change network mode
|
||||
j19 := mock.Job()
|
||||
j19.TaskGroups[0].Networks = j19.TaskGroups[0].Tasks[0].Resources.Networks
|
||||
j19.TaskGroups[0].Tasks[0].Resources.Networks = nil
|
||||
|
||||
j20 := mock.Job()
|
||||
j20.TaskGroups[0].Networks = j20.TaskGroups[0].Tasks[0].Resources.Networks
|
||||
j20.TaskGroups[0].Tasks[0].Resources.Networks = nil
|
||||
|
||||
require.False(t, tasksUpdated(j19, j20, name))
|
||||
|
||||
j20.TaskGroups[0].Networks[0].Mode = "bridge"
|
||||
require.True(t, tasksUpdated(j19, j20, name))
|
||||
}
|
||||
|
||||
func TestEvictAndPlace_LimitLessThanAllocs(t *testing.T) {
|
||||
|
|
Loading…
Reference in New Issue