From 86c07c1f1594826713340b9e5276048cc70ae3d4 Mon Sep 17 00:00:00 2001 From: Izabella Raulin Date: Thu, 20 Oct 2016 18:29:04 +0200 Subject: [PATCH] Removed JSON RPC from tests cases --- control/plugin/collector_test.go | 8 +++++--- control/plugin/processor_test.go | 8 +++----- control/plugin/publisher_test.go | 15 +++++++-------- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/control/plugin/collector_test.go b/control/plugin/collector_test.go index de7ae3a72..53a7d7b06 100644 --- a/control/plugin/collector_test.go +++ b/control/plugin/collector_test.go @@ -51,15 +51,17 @@ func TestStartCollector(t *testing.T) { Convey("Collector", t, func() { Convey("start with dynamic port", func() { m := &PluginMeta{ - RPCType: JSONRPC, + RPCType: NativeRPC, Type: CollectorPluginType, } c := new(MockPlugin) + err, rc := Start(m, c, "{}") So(err, ShouldBeNil) So(rc, ShouldEqual, 0) - Convey("RPC service already registered", func() { - So(func() { Start(m, c, "{}") }, ShouldPanic) + + Convey("RPC service should not panic", func() { + So(func() { Start(m, c, "{}") }, ShouldNotPanic) }) }) }) diff --git a/control/plugin/processor_test.go b/control/plugin/processor_test.go index b6221165e..738b76772 100644 --- a/control/plugin/processor_test.go +++ b/control/plugin/processor_test.go @@ -109,13 +109,11 @@ func TestStartProcessor(t *testing.T) { Convey("start with dynamic port", func() { c := new(MockProcessor) m := &PluginMeta{ - RPCType: JSONRPC, + RPCType: NativeRPC, Type: ProcessorPluginType, } - // we will panic since rpc.HandleHttp has already - // been called during TestStartCollector - Convey("RPC service already registered", func() { - So(func() { Start(m, c, "{}") }, ShouldPanic) + Convey("RPC service should not panic", func() { + So(func() { Start(m, c, "{}") }, ShouldNotPanic) }) }) diff --git a/control/plugin/publisher_test.go b/control/plugin/publisher_test.go index 41b9aacb4..fdab463bc 100644 --- a/control/plugin/publisher_test.go +++ b/control/plugin/publisher_test.go @@ -40,8 +40,8 @@ func (f *MockPublisher) Publish(_ string, _ []byte, _ map[string]ctypes.ConfigVa return nil } -func (f *MockPublisher) GetConfigPolicy() cpolicy.ConfigPolicy { - return cpolicy.ConfigPolicy{} +func (f *MockPublisher) GetConfigPolicy() (*cpolicy.ConfigPolicy, error) { + return &cpolicy.ConfigPolicy{}, nil } type MockPublisherSessionState struct { @@ -107,15 +107,14 @@ func (s *MockPublisherSessionState) heartbeatWatch(killChan chan int) { func TestStartPublisher(t *testing.T) { Convey("Publisher", t, func() { Convey("start with dynamic port", func() { - c := new(MockProcessor) + c := new(MockPublisher) m := &PluginMeta{ - RPCType: JSONRPC, + RPCType: NativeRPC, Type: PublisherPluginType, } - // we will panic since rpc.HandleHttp has already - // been called during TestStartCollector - Convey("RPC service already registered", func() { - So(func() { Start(m, c, "{}") }, ShouldPanic) + + Convey("RPC service should not panic", func() { + So(func() { Start(m, c, "{}") }, ShouldNotPanic) }) })