From babc68adfb7a37c571c602dd2d1ed7c3786cbf10 Mon Sep 17 00:00:00 2001 From: Diptanu Choudhury Date: Sat, 14 Nov 2015 22:28:11 -0800 Subject: [PATCH] Fixing the scheduler tests --- scheduler/generic_sched_test.go | 3 ++- scheduler/system_sched_test.go | 3 ++- scheduler/util_test.go | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/scheduler/generic_sched_test.go b/scheduler/generic_sched_test.go index dfb35cb3c..e3e875578 100644 --- a/scheduler/generic_sched_test.go +++ b/scheduler/generic_sched_test.go @@ -397,9 +397,10 @@ func TestServiceSched_JobModify_InPlace(t *testing.T) { h.AssertEvalStatus(t, structs.EvalStatusComplete) // Verify the network did not change + rp := structs.Port{"main", 5000} for _, alloc := range out { for _, resources := range alloc.TaskResources { - if resources.Networks[0].ReservedPorts[0] != 5000 { + if resources.Networks[0].ReservedPorts[0] != rp { t.Fatalf("bad: %#v", alloc) } } diff --git a/scheduler/system_sched_test.go b/scheduler/system_sched_test.go index ece805057..c6f186ee3 100644 --- a/scheduler/system_sched_test.go +++ b/scheduler/system_sched_test.go @@ -463,9 +463,10 @@ func TestSystemSched_JobModify_InPlace(t *testing.T) { h.AssertEvalStatus(t, structs.EvalStatusComplete) // Verify the network did not change + rp := structs.Port{"main", 5000} for _, alloc := range out { for _, resources := range alloc.TaskResources { - if resources.Networks[0].ReservedPorts[0] != 5000 { + if resources.Networks[0].ReservedPorts[0] != rp { t.Fatalf("bad: %#v", alloc) } } diff --git a/scheduler/util_test.go b/scheduler/util_test.go index 7873c55c5..f7a5274f3 100644 --- a/scheduler/util_test.go +++ b/scheduler/util_test.go @@ -343,7 +343,7 @@ func TestTasksUpdated(t *testing.T) { } j6 := mock.Job() - j6.TaskGroups[0].Tasks[0].Resources.Networks[0].DynamicPorts = []string{"http", "https", "admin"} + j6.TaskGroups[0].Tasks[0].Resources.Networks[0].DynamicPorts = []structs.Port{{"http", 0}, {"https", 0}, {"admin", 0}} if !tasksUpdated(j1.TaskGroups[0], j6.TaskGroups[0]) { t.Fatalf("bad") }