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

Removed JSON RPC from tests cases #1302

Merged
merged 1 commit into from
Oct 21, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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