From 3ce4c171f10e5d2ec8af6401da5ce7c19bfd32a1 Mon Sep 17 00:00:00 2001 From: Gianluca Arbezzano Date: Wed, 15 Mar 2017 21:56:58 +0000 Subject: [PATCH] Fixed tests --- core/daemon_test.go | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/core/daemon_test.go b/core/daemon_test.go index c4f824f..a48868a 100644 --- a/core/daemon_test.go +++ b/core/daemon_test.go @@ -1,8 +1,15 @@ package core -import "testing" +import ( + "testing" + + "github.com/gianarb/orbiter/autoscaler" +) func TestNewCore(t *testing.T) { + core := Core{ + Autoscalers: autoscaler.Autoscalers{}, + } conf := map[string]AutoscalerConf{ "first-scaler": AutoscalerConf{ Provider: "fake", @@ -29,7 +36,7 @@ func TestNewCore(t *testing.T) { }, }, } - core, err := NewCoreByConfig(conf) + err := NewCoreByConfig(conf, &core) if err != nil { t.Fatal(err) } @@ -39,6 +46,9 @@ func TestNewCore(t *testing.T) { } func TestGetSingleAutoscaler(t *testing.T) { + core := Core{ + Autoscalers: autoscaler.Autoscalers{}, + } conf := map[string]AutoscalerConf{ "second": AutoscalerConf{ Provider: "fake", @@ -55,7 +65,7 @@ func TestGetSingleAutoscaler(t *testing.T) { }, }, } - core, _ := NewCoreByConfig(conf) + NewCoreByConfig(conf, &core) _, ok := core.Autoscalers["second/micro"] if ok == false { t.Fatal("micro exist") @@ -63,6 +73,9 @@ func TestGetSingleAutoscaler(t *testing.T) { } func TestNewCoreWithUnsupportedProvider(t *testing.T) { + core := Core{ + Autoscalers: autoscaler.Autoscalers{}, + } conf := map[string]AutoscalerConf{ "second-scaler": AutoscalerConf{ Provider: "fake", @@ -89,7 +102,7 @@ func TestNewCoreWithUnsupportedProvider(t *testing.T) { }, }, } - _, err := NewCoreByConfig(conf) + err := NewCoreByConfig(conf, &core) if err.Error() != "lalala not supported." { t.Fatal(err) }