Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

Commit

Permalink
Removed JSON RPC from tests cases
Browse files Browse the repository at this point in the history
  • Loading branch information
IzabellaRaulin committed Oct 20, 2016
1 parent 0973d5f commit 86c07c1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 16 deletions.
8 changes: 5 additions & 3 deletions control/plugin/collector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
})
})
Expand Down
8 changes: 3 additions & 5 deletions control/plugin/processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})

})
Expand Down
15 changes: 7 additions & 8 deletions control/plugin/publisher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
})

})
Expand Down

0 comments on commit 86c07c1

Please sign in to comment.