diff --git a/apier/v1/apier_it_test.go b/apier/v1/apier_it_test.go index 5735c9e0d..9be9e6519 100644 --- a/apier/v1/apier_it_test.go +++ b/apier/v1/apier_it_test.go @@ -136,6 +136,7 @@ var ( testApierReplayFailedPosts, testApierGetDataDBVesions, testApierGetStorDBVesions, + testApierBackwardsCompatible, testApierStopEngine, } ) @@ -1999,6 +2000,15 @@ func testApierGetStorDBVesions(t *testing.T) { } } +func testApierBackwardsCompatible(t *testing.T) { + var reply string + if err := rater.Call("ApierV1.Ping", new(utils.CGREvent), &reply); err != nil { + t.Error(err) + } else if reply != utils.Pong { + t.Errorf("Expecting : %+v, received: %+v", utils.Pong, reply) + } +} + // Simply kill the engine after we are done with tests within this file func testApierStopEngine(t *testing.T) { if err := engine.KillEngine(100); err != nil { diff --git a/apier/v2/apier.go b/apier/v2/apier.go index a0a901c9d..4dc77a4ad 100644 --- a/apier/v2/apier.go +++ b/apier/v2/apier.go @@ -334,3 +334,9 @@ func (apiv2 *APIerSv2) SetActions(attrs utils.AttrSetActions, reply *string) err *reply = utils.OK return nil } + +// Ping return pong if the service is active +func (apiv2 *APIerSv2) Ping(ign *utils.CGREvent, reply *string) error { + *reply = utils.Pong + return nil +} diff --git a/apier/v2/apierv2_it_test.go b/apier/v2/apierv2_it_test.go index a15b2c860..b7021d61c 100644 --- a/apier/v2/apierv2_it_test.go +++ b/apier/v2/apierv2_it_test.go @@ -55,6 +55,7 @@ var ( testAPIerSv2itSetActionWithCategory, testAPIerSv2itSetActionPlanWithWrongTiming, testAPIerSv2itSetActionPlanWithWrongTiming2, + testAPIerSv2BackwardsCompatible, testAPIerSv2itKillEngine, } ) @@ -430,6 +431,15 @@ func testAPIerSv2itSetActionPlanWithWrongTiming2(t *testing.T) { } } +func testAPIerSv2BackwardsCompatible(t *testing.T) { + var reply string + if err := apierRPC.Call("ApierV2.Ping", new(utils.CGREvent), &reply); err != nil { + t.Error(err) + } else if reply != utils.Pong { + t.Errorf("Expecting : %+v, received: %+v", utils.Pong, reply) + } +} + func testAPIerSv2itKillEngine(t *testing.T) { if err := engine.KillEngine(delay); err != nil { t.Error(err)