mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-21 15:18:44 +05:00
Updated unit tests
This commit is contained in:
committed by
Dan Christian Bogos
parent
97eeadf8cc
commit
cf94fb5292
@@ -370,108 +370,6 @@ func TestCmdPingAnalyzerSLow(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestCmdPingSchedulerSLow(t *testing.T) {
|
||||
// commands map is initiated in init function
|
||||
command := commands["ping"]
|
||||
castCommand, canCast := command.(*CmdApierPing)
|
||||
if !canCast {
|
||||
t.Fatalf("cannot cast")
|
||||
}
|
||||
castCommand.item = utils.SchedulerSLow
|
||||
result2 := command.RpcMethod()
|
||||
if !reflect.DeepEqual(result2, utils.SchedulerSv1Ping) {
|
||||
t.Errorf("Expected <%+v>, Received <%+v>", utils.SchedulerSv1Ping, result2)
|
||||
}
|
||||
m, ok := reflect.TypeOf(new(v1.SchedulerSv1)).MethodByName(strings.Split(command.RpcMethod(), utils.NestingSep)[1])
|
||||
if !ok {
|
||||
t.Fatal("method not found")
|
||||
}
|
||||
if m.Type.NumIn() != 3 { // ApierSv1 is consider and we expect 3 inputs
|
||||
t.Fatalf("invalid number of input parameters ")
|
||||
}
|
||||
// for coverage purpose
|
||||
result := command.RpcParams(true)
|
||||
if !reflect.DeepEqual(result, new(StringWrapper)) {
|
||||
t.Errorf("Expected <%T>, Received <%T>", new(StringWrapper), result)
|
||||
}
|
||||
// verify the type of output parameter
|
||||
if ok := m.Type.In(2).AssignableTo(reflect.TypeOf(command.RpcResult())); !ok {
|
||||
t.Fatalf("cannot assign output parameter")
|
||||
}
|
||||
// for coverage purpose
|
||||
if err := command.PostprocessRpcParams(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCmdPingRALsLow(t *testing.T) {
|
||||
// commands map is initiated in init function
|
||||
command := commands["ping"]
|
||||
castCommand, canCast := command.(*CmdApierPing)
|
||||
if !canCast {
|
||||
t.Fatalf("cannot cast")
|
||||
}
|
||||
castCommand.item = utils.RALsLow
|
||||
result2 := command.RpcMethod()
|
||||
if !reflect.DeepEqual(result2, utils.RALsV1Ping) {
|
||||
t.Errorf("Expected <%+v>, Received <%+v>", utils.RALsV1Ping, result2)
|
||||
}
|
||||
m, ok := reflect.TypeOf(new(v1.RALsV1)).MethodByName(strings.Split(command.RpcMethod(), utils.NestingSep)[1])
|
||||
if !ok {
|
||||
t.Fatal("method not found")
|
||||
}
|
||||
if m.Type.NumIn() != 3 { // ApierSv1 is consider and we expect 3 inputs
|
||||
t.Fatalf("invalid number of input parameters ")
|
||||
}
|
||||
// for coverage purpose
|
||||
result := command.RpcParams(true)
|
||||
if !reflect.DeepEqual(result, new(StringWrapper)) {
|
||||
t.Errorf("Expected <%T>, Received <%T>", new(StringWrapper), result)
|
||||
}
|
||||
// verify the type of output parameter
|
||||
if ok := m.Type.In(2).AssignableTo(reflect.TypeOf(command.RpcResult())); !ok {
|
||||
t.Fatalf("cannot assign output parameter")
|
||||
}
|
||||
// for coverage purpose
|
||||
if err := command.PostprocessRpcParams(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCmdPingReplicatorLow(t *testing.T) {
|
||||
// commands map is initiated in init function
|
||||
command := commands["ping"]
|
||||
castCommand, canCast := command.(*CmdApierPing)
|
||||
if !canCast {
|
||||
t.Fatalf("cannot cast")
|
||||
}
|
||||
castCommand.item = utils.ReplicatorLow
|
||||
result2 := command.RpcMethod()
|
||||
if !reflect.DeepEqual(result2, utils.ReplicatorSv1Ping) {
|
||||
t.Errorf("Expected <%+v>, Received <%+v>", utils.RALsV1Ping, result2)
|
||||
}
|
||||
m, ok := reflect.TypeOf(new(v1.ReplicatorSv1)).MethodByName(strings.Split(command.RpcMethod(), utils.NestingSep)[1])
|
||||
if !ok {
|
||||
t.Fatal("method not found")
|
||||
}
|
||||
if m.Type.NumIn() != 3 { // ApierSv1 is consider and we expect 3 inputs
|
||||
t.Fatalf("invalid number of input parameters ")
|
||||
}
|
||||
// for coverage purpose
|
||||
result := command.RpcParams(true)
|
||||
if !reflect.DeepEqual(result, new(StringWrapper)) {
|
||||
t.Errorf("Expected <%T>, Received <%T>", new(StringWrapper), result)
|
||||
}
|
||||
// verify the type of output parameter
|
||||
if ok := m.Type.In(2).AssignableTo(reflect.TypeOf(command.RpcResult())); !ok {
|
||||
t.Fatalf("cannot assign output parameter")
|
||||
}
|
||||
// for coverage purpose
|
||||
if err := command.PostprocessRpcParams(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCmdPingApierSLow(t *testing.T) {
|
||||
// commands map is initiated in init function
|
||||
command := commands["ping"]
|
||||
|
||||
Reference in New Issue
Block a user