From be4cd4d8a4367cd4f2ae2c5295133d3df23b59ed Mon Sep 17 00:00:00 2001 From: Armon Dadgar Date: Thu, 13 Aug 2015 18:51:08 -0700 Subject: [PATCH] scheduler: adding tests --- scheduler/service_sched_test.go | 12 +++++++++ scheduler/stack_test.go | 43 +++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 scheduler/stack_test.go diff --git a/scheduler/service_sched_test.go b/scheduler/service_sched_test.go index c3cb29595..cdcdb2fcf 100644 --- a/scheduler/service_sched_test.go +++ b/scheduler/service_sched_test.go @@ -7,6 +7,14 @@ import ( "github.com/hashicorp/nomad/nomad/structs" ) +func TestServiceSched_JobRegister(t *testing.T) { + // TODO +} + +func TestServiceSched_JobModify(t *testing.T) { + // TODO +} + func TestServiceSched_JobDeregister(t *testing.T) { h := NewHarness(t) @@ -56,3 +64,7 @@ func TestServiceSched_JobDeregister(t *testing.T) { t.Fatalf("bad: %#v", out) } } + +func TestServiceSched_NodeDrain(t *testing.T) { + // TODO +} diff --git a/scheduler/stack_test.go b/scheduler/stack_test.go new file mode 100644 index 000000000..2fa37d2e5 --- /dev/null +++ b/scheduler/stack_test.go @@ -0,0 +1,43 @@ +package scheduler + +import ( + "reflect" + "testing" + + "github.com/hashicorp/nomad/nomad/mock" +) + +func TestServiceStack_SetJob(t *testing.T) { + _, ctx := testContext(t) + stack := NewServiceStack(ctx, nil) + + job := mock.Job() + stack.SetJob(job) + + if stack.binPack.priority != job.Priority { + t.Fatalf("bad") + } + if !reflect.DeepEqual(stack.jobConstraint.constraints, job.Constraints) { + t.Fatalf("bad") + } +} + +func TestServiceStack_Select_Size(t *testing.T) { + // TODO +} + +func TestServiceStack_Select_MetricsReset(t *testing.T) { + // TODO +} + +func TestServiceStack_Select_DriverFilter(t *testing.T) { + // TODO +} + +func TestServiceStack_Select_ConstraintFilter(t *testing.T) { + // TODO +} + +func TestServiceStack_Select_BinPack_Overflow(t *testing.T) { + // TODO +}