From e857225129c2476975b22cf4a9f8bd331e18053d Mon Sep 17 00:00:00 2001 From: Michael Schurter Date: Fri, 8 Dec 2017 14:50:06 -0800 Subject: [PATCH] Fix port labels on mock Alloc/Job/Node --- nomad/mock/mock.go | 15 +++++++++------ scheduler/generic_sched_test.go | 2 +- scheduler/system_sched_test.go | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/nomad/mock/mock.go b/nomad/mock/mock.go index 41813f790..d0c889b09 100644 --- a/nomad/mock/mock.go +++ b/nomad/mock/mock.go @@ -41,7 +41,7 @@ func Node() *structs.Node { { Device: "eth0", IP: "192.168.0.100", - ReservedPorts: []structs.Port{{Label: "main", Value: 22}}, + ReservedPorts: []structs.Port{{Label: "ssh", Value: 22}}, MBits: 1, }, }, @@ -119,7 +119,7 @@ func Job() *structs.Job { }, { Name: "${TASK}-admin", - PortLabel: "main", + PortLabel: "admin", }, }, LogConfig: structs.DefaultLogConfig(), @@ -128,8 +128,11 @@ func Job() *structs.Job { MemoryMB: 256, Networks: []*structs.NetworkResource{ { - MBits: 50, - DynamicPorts: []structs.Port{{Label: "http"}, {Label: "admin"}}, + MBits: 50, + DynamicPorts: []structs.Port{ + {Label: "http"}, + {Label: "admin"}, + }, }, }, }, @@ -273,7 +276,7 @@ func Alloc() *structs.Allocation { { Device: "eth0", IP: "192.168.0.100", - ReservedPorts: []structs.Port{{Label: "main", Value: 5000}}, + ReservedPorts: []structs.Port{{Label: "admin", Value: 5000}}, MBits: 50, DynamicPorts: []structs.Port{{Label: "http"}}, }, @@ -287,7 +290,7 @@ func Alloc() *structs.Allocation { { Device: "eth0", IP: "192.168.0.100", - ReservedPorts: []structs.Port{{Label: "main", Value: 5000}}, + ReservedPorts: []structs.Port{{Label: "admin", Value: 5000}}, MBits: 50, DynamicPorts: []structs.Port{{Label: "http"}}, }, diff --git a/scheduler/generic_sched_test.go b/scheduler/generic_sched_test.go index cdc415eb1..02296ff76 100644 --- a/scheduler/generic_sched_test.go +++ b/scheduler/generic_sched_test.go @@ -1893,7 +1893,7 @@ func TestServiceSched_JobModify_InPlace(t *testing.T) { h.AssertEvalStatus(t, structs.EvalStatusComplete) // Verify the network did not change - rp := structs.Port{Label: "main", Value: 5000} + rp := structs.Port{Label: "admin", Value: 5000} for _, alloc := range out { for _, resources := range alloc.TaskResources { if resources.Networks[0].ReservedPorts[0] != rp { diff --git a/scheduler/system_sched_test.go b/scheduler/system_sched_test.go index 2b25fbb56..be43026a1 100644 --- a/scheduler/system_sched_test.go +++ b/scheduler/system_sched_test.go @@ -777,7 +777,7 @@ func TestSystemSched_JobModify_InPlace(t *testing.T) { h.AssertEvalStatus(t, structs.EvalStatusComplete) // Verify the network did not change - rp := structs.Port{Label: "main", Value: 5000} + rp := structs.Port{Label: "admin", Value: 5000} for _, alloc := range out { for _, resources := range alloc.TaskResources { if resources.Networks[0].ReservedPorts[0] != rp {