diff --git a/dispatchers/attributes_it_test.go b/dispatchers/attributes_it_test.go index 303ad4645..4737817ab 100755 --- a/dispatchers/attributes_it_test.go +++ b/dispatchers/attributes_it_test.go @@ -95,6 +95,12 @@ func testDspAttrPingFailover(t *testing.T) { } allEngine.startEngine(t) allEngine2.startEngine(t) + reply = "" + if err := dispEngine.RCP.Call(utils.AttributeSv1Ping, &ev, &reply); err != nil { + t.Error(err) + } else if reply != utils.Pong { + t.Errorf("Received: %s", reply) + } } func testDspAttrGetAttrFailover(t *testing.T) { diff --git a/engine/dispatcherprfl_test.go b/engine/dispatcherprfl_test.go index 7e8998279..bb146af46 100644 --- a/engine/dispatcherprfl_test.go +++ b/engine/dispatcherprfl_test.go @@ -221,5 +221,37 @@ func TestDispatcherProfilesSort(t *testing.T) { if dProf.Sort(); !reflect.DeepEqual(eProf, dProf) { t.Errorf("expecting: %+v, received: %+v", utils.ToJSON(eProf), utils.ToJSON(dProf)) } - +} + +type testRPCHost struct { + serviceMethod string + args interface{} + reply interface{} +} + +func (v *testRPCHost) Call(serviceMethod string, args interface{}, reply interface{}) error { + v.serviceMethod = serviceMethod + v.args = args + v.reply = reply + return nil +} + +func TestDispatcherHostCall(t *testing.T) { + tRPC := &testRPCHost{} + dspHost := DispatcherHost{} + etRPC := &testRPCHost{ + serviceMethod: utils.AttributeSv1Ping, + args: &utils.CGREvent{}, + reply: utils.StringPointer(""), + } + var reply string + if err := dspHost.Call(utils.AttributeSv1Ping, &utils.CGREvent{}, &reply); err == nil || err.Error() != utils.ErrNotConnected.Error() { + t.Errorf("Expected: %s , received: %v", utils.ErrNotConnected.Error(), err) + } + dspHost.rpcConn = tRPC + if err := dspHost.Call(utils.AttributeSv1Ping, &utils.CGREvent{}, &reply); err != nil { + t.Error(err) + } else if !reflect.DeepEqual(*etRPC, *tRPC) { + t.Errorf("Expected: %s , received: %s", utils.ToJSON(etRPC), utils.ToJSON(tRPC)) + } }