Fix engine integration tests

This commit is contained in:
Trial97
2018-11-29 12:44:43 +02:00
committed by Dan Christian Bogos
parent bbc863f8ab
commit a65346fed2
2 changed files with 9 additions and 4 deletions

View File

@@ -53,7 +53,7 @@ var sTestsTutIT = []func(t *testing.T){
testTPitRpcConn,
testTPitTimings,
testTPitDestinations,
// ToDo: test engine shutdown
testTPitKillEngine,
}
// Tests starting here
@@ -256,3 +256,8 @@ func testTPitDestinations(t *testing.T) {
t.Errorf("Calling ApierV2.GetTPDestinationIDs expected: %v, received: %v", expectedDstIds, rplyDstIds)
}
}
func testTPitKillEngine(t *testing.T) {
if err := engine.KillEngine(100); err != nil {
t.Error(err)
}
}

View File

@@ -37,7 +37,7 @@ var actsLclCfg *config.CGRConfig
var actsLclRpc *rpc.Client
var actsLclCfgPath = path.Join(*dataDir, "conf", "samples", "actions")
var waitRater = flag.Int("wait_rater", 100, "Number of miliseconds to wait for rater to start and cache")
var waitRater = flag.Int("wait_rater", 500, "Number of miliseconds to wait for rater to start and cache")
func TestActionsitInitCfg(t *testing.T) {
// Init config first
@@ -61,7 +61,7 @@ func TestActionsitInitCdrDb(t *testing.T) {
// Finds cgr-engine executable and starts it with default configuration
func TestActionsitStartEngine(t *testing.T) {
if _, err := StartEngine(actsLclCfgPath, *waitRater); err != nil {
if _, err := StopStartEngine(actsLclCfgPath, *waitRater); err != nil {
t.Fatal(err)
}
}
@@ -69,7 +69,7 @@ func TestActionsitStartEngine(t *testing.T) {
// Connect rpc client to rater
func TestActionsitRpcConn(t *testing.T) {
var err error
time.Sleep(500 * time.Millisecond)
// time.Sleep(500 * time.Millisecond)
actsLclRpc, err = jsonrpc.Dial("tcp", actsLclCfg.ListenCfg().RPCJSONListen) // We connect over JSON so we can also troubleshoot if needed
if err != nil {
t.Fatal(err)