Add integration test for backwards compatible with ApierV1/ApierV2

This commit is contained in:
TeoV
2020-02-10 11:16:25 +02:00
committed by Dan Christian Bogos
parent 3c4c39b66c
commit 91687a3111
3 changed files with 26 additions and 0 deletions

View File

@@ -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 {

View File

@@ -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
}

View File

@@ -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)