mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Cover the remainder of dispatcherprfl.go in engine
This commit is contained in:
committed by
Dan Christian Bogos
parent
79a96d80f8
commit
e8eafdd766
@@ -21,6 +21,7 @@ import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/cgrates/cgrates/config"
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
)
|
||||
|
||||
@@ -293,3 +294,47 @@ func TestDispatcherHostIDsProfilesClone(t *testing.T) {
|
||||
t.Errorf("expecting: %+v, received: %+v", utils.ToJSON(eConns), utils.ToJSON(dConns))
|
||||
}
|
||||
}
|
||||
|
||||
func TestDispatcherHostProfileCloneWithParams(t *testing.T) {
|
||||
dC := &DispatcherHostProfile{
|
||||
ID: "testID",
|
||||
Weight: 10,
|
||||
Blocker: false,
|
||||
Params: map[string]interface{}{
|
||||
"param1": "value of param1",
|
||||
"param2": "value of param2",
|
||||
},
|
||||
}
|
||||
|
||||
exp := &DispatcherHostProfile{
|
||||
ID: "testID",
|
||||
Weight: 10,
|
||||
Blocker: false,
|
||||
Params: map[string]interface{}{
|
||||
"param1": "value of param1",
|
||||
"param2": "value of param2",
|
||||
},
|
||||
}
|
||||
rcv := dC.Clone()
|
||||
|
||||
if !reflect.DeepEqual(rcv, exp) {
|
||||
t.Errorf("\nexpected: <%+v>, \nreceived: <%+v", exp, rcv)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDispatcherHostCallNilRPCConn(t *testing.T) {
|
||||
dH := &DispatcherHost{
|
||||
Tenant: "cgrates.org",
|
||||
RemoteHost: config.NewDfltRemoteHost(),
|
||||
}
|
||||
|
||||
var args int
|
||||
var reply *int
|
||||
|
||||
experr := "dial tcp 127.0.0.1:2012: connect: connection refused"
|
||||
err := dH.Call("method", args, reply)
|
||||
|
||||
if err == nil || err.Error() != experr {
|
||||
t.Errorf("\nexpected: <%+v>, \nreceived: <%+v>", experr, err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user