Fixed tests and refactored code in Dispatchers and Engine

This commit is contained in:
andronache
2021-04-26 16:59:25 +03:00
committed by Dan Christian Bogos
parent 77ae2a9158
commit 6c0c8c5066
20 changed files with 252 additions and 247 deletions

View File

@@ -33,7 +33,7 @@ func TestDspAttributeSv1PingError(t *testing.T) {
cgrEvent := &utils.CGREvent{}
var reply *string
err := dspSrv.AttributeSv1Ping(cgrEvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if err == nil || err.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, err)
}
@@ -51,7 +51,7 @@ func TestDspAttributeSv1PingErrorTenant(t *testing.T) {
}
var reply *string
err := dspSrv.AttributeSv1Ping(cgrEvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if err == nil || err.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, err)
}
@@ -62,7 +62,7 @@ func TestDspAttributeSv1PingErrorNil(t *testing.T) {
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
var reply *string
err := dspSrv.AttributeSv1Ping(nil, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if err == nil || err.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, err)
}
@@ -153,7 +153,7 @@ func TestDspAttributeSv1GetAttributeForEventErrorAttributeS(t *testing.T) {
var reply *engine.AttributeProfile
err := dspSrv.AttributeSv1GetAttributeForEvent(processEvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if err == nil || err.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, err)
}
@@ -177,7 +177,7 @@ func TestDspAttributeSv1ProcessEventError(t *testing.T) {
var reply *engine.AttrSProcessEventReply
err := dspSrv.AttributeSv1ProcessEvent(processEvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if err == nil || err.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, err)
}

View File

@@ -39,7 +39,7 @@ func TestDspCacheSv1PingError(t *testing.T) {
}
var reply *string
result := dspSrv.CacheSv1Ping(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -50,7 +50,7 @@ func TestDspCacheSv1PingErrorArgs(t *testing.T) {
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
var reply *string
result := dspSrv.CacheSv1Ping(nil, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -96,7 +96,7 @@ func TestDspCacheSv1GetItemIDsErrorArgsNil(t *testing.T) {
}
var reply *[]string
result := dspSrv.CacheSv1GetItemIDs(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -123,7 +123,7 @@ func TestDspCacheSv1HasItemErrorArgsNil(t *testing.T) {
}
var reply *bool
result := dspSrv.CacheSv1HasItem(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -150,7 +150,7 @@ func TestDspCacheSv1GetItemExpiryTimeCacheSv1GetItemExpiryTimeErrorArgsNil(t *te
}
var reply *time.Time
result := dspSrv.CacheSv1GetItemExpiryTime(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -177,7 +177,7 @@ func TestDspCacheSv1RemoveItemArgsNil(t *testing.T) {
}
var reply *string
result := dspSrv.CacheSv1RemoveItem(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -204,7 +204,7 @@ func TestDspCacheSv1RemoveItemsArgsNil(t *testing.T) {
}
var reply *string
result := dspSrv.CacheSv1RemoveItems(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -231,7 +231,7 @@ func TestDspCacheSv1ClearArgsNil(t *testing.T) {
}
var reply *string
result := dspSrv.CacheSv1Clear(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -258,7 +258,7 @@ func TestDspCacheSv1GetCacheStatsArgsNil(t *testing.T) {
}
var reply *map[string]*ltcache.CacheStats
result := dspSrv.CacheSv1GetCacheStats(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -285,7 +285,7 @@ func TestDspCacheSv1PrecacheStatusArgsNil(t *testing.T) {
}
var reply *map[string]string
result := dspSrv.CacheSv1PrecacheStatus(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -312,7 +312,7 @@ func TestDspCacheSv1HasGroupArgsNil(t *testing.T) {
}
var reply *bool
result := dspSrv.CacheSv1HasGroup(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -339,7 +339,7 @@ func TestDspCacheSv1GetGroupItemIDsArgsNil(t *testing.T) {
}
var reply *[]string
result := dspSrv.CacheSv1GetGroupItemIDs(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -366,7 +366,7 @@ func TestDspCacheSv1RemoveGroupArgsNil(t *testing.T) {
}
var reply *string
result := dspSrv.CacheSv1RemoveGroup(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -393,7 +393,7 @@ func TestDspCacheSv1ReloadCacheNil(t *testing.T) {
}
var reply *string
result := dspSrv.CacheSv1ReloadCache(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -420,7 +420,7 @@ func TestDspCacheSv1LoadCacheNil(t *testing.T) {
}
var reply *string
result := dspSrv.CacheSv1LoadCache(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -447,7 +447,7 @@ func TestDspCacheSv1ReplicateRemoveNil(t *testing.T) {
}
var reply *string
result := dspSrv.CacheSv1ReplicateRemove(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -474,7 +474,7 @@ func TestDspCacheSv1ReplicateSetNil(t *testing.T) {
}
var reply *string
result := dspSrv.CacheSv1ReplicateSet(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}

View File

@@ -47,7 +47,7 @@ func TestDspCDRsV1PingNil(t *testing.T) {
}
var reply *string
result := dspSrv.CDRsV1Ping(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -86,7 +86,7 @@ func TestDspCDRsV1GetCDRsNil(t *testing.T) {
}
var reply *[]*engine.CDR
result := dspSrv.CDRsV1GetCDRs(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -113,7 +113,7 @@ func TestDspCDRsV1GetCDRsCountNil(t *testing.T) {
}
var reply *int64
result := dspSrv.CDRsV1GetCDRsCount(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -140,7 +140,7 @@ func TestDspCDRsV1RateCDRsNil(t *testing.T) {
}
var reply *string
result := dspSrv.CDRsV1RateCDRs(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -173,7 +173,7 @@ func TestDspCDRsV1ProcessExternalCDRNil(t *testing.T) {
}
var reply *string
result := dspSrv.CDRsV1ProcessExternalCDR(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -206,7 +206,7 @@ func TestDspCDRsV1ProcessEventNil(t *testing.T) {
}
var reply *string
result := dspSrv.CDRsV1ProcessEvent(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -239,7 +239,7 @@ func TestDspCDRsV1ProcessCDRNil(t *testing.T) {
}
var reply *string
result := dspSrv.CDRsV1ProcessCDR(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -274,7 +274,7 @@ func TestDspCDRsV2ProcessEventNil(t *testing.T) {
}
var reply *[]*utils.EventWithFlags
result := dspSrv.CDRsV2ProcessEvent(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -304,7 +304,7 @@ func TestDspCDRsV1StoreSessionCostNil(t *testing.T) {
}
var reply *string
result := dspSrv.CDRsV1StoreSessionCost(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -331,7 +331,7 @@ func TestDspCDRsV2StoreSessionCostNil(t *testing.T) {
}
var reply *string
result := dspSrv.CDRsV2StoreSessionCost(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}

View File

@@ -31,7 +31,7 @@ func TestDspChargerSv1PingNilStruct(t *testing.T) {
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
var reply *string
result := dspSrv.ChargerSv1Ping(nil, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -45,7 +45,7 @@ func TestDspChargerSv1PingNil(t *testing.T) {
}
var reply *string
result := dspSrv.ChargerSv1Ping(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -72,7 +72,7 @@ func TestDspChargerSv1GetChargersForEventNil(t *testing.T) {
}
var reply *engine.ChargerProfiles
result := dspSrv.ChargerSv1GetChargersForEvent(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -99,7 +99,7 @@ func TestDspChargerSv1ProcessEventNil(t *testing.T) {
}
var reply *[]*engine.ChrgSProcessEventReply
result := dspSrv.ChargerSv1ProcessEvent(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}

View File

@@ -32,7 +32,7 @@ func TestDspConfigSv1GetConfigNil(t *testing.T) {
}
var reply *map[string]interface{}
result := dspSrv.ConfigSv1GetConfig(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -59,7 +59,7 @@ func TestDspConfigSv1ReloadConfigNil(t *testing.T) {
}
var reply *string
result := dspSrv.ConfigSv1ReloadConfig(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -86,7 +86,7 @@ func TestDspConfigSv1SetConfigNil(t *testing.T) {
}
var reply *string
result := dspSrv.ConfigSv1SetConfig(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -113,7 +113,7 @@ func TestDspConfigSv1SetConfigFromJSONNil(t *testing.T) {
}
var reply *string
result := dspSrv.ConfigSv1SetConfigFromJSON(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -140,7 +140,7 @@ func TestDspConfigSv1GetConfigAsJSONNil(t *testing.T) {
}
var reply *string
result := dspSrv.ConfigSv1GetConfigAsJSON(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}

View File

@@ -33,7 +33,7 @@ func TestDspCoreSv1StatusNil(t *testing.T) {
}
var reply *map[string]interface{}
result := dspSrv.CoreSv1Status(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -60,7 +60,7 @@ func TestDspCoreSv1PingNil(t *testing.T) {
}
var reply *string
result := dspSrv.CoreSv1Ping(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -87,7 +87,7 @@ func TestDspCoreSv1SleepNil(t *testing.T) {
}
var reply *string
result := dspSrv.CoreSv1Sleep(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}

View File

@@ -93,7 +93,7 @@ func TestDispatcherV1GetProfileForEventErr(t *testing.T) {
ev := &utils.CGREvent{}
dPfl := &engine.DispatcherProfile{}
err := dsp.V1GetProfileForEvent(ev, dPfl)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if err == nil || err.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, err)
}
@@ -106,7 +106,7 @@ func TestDispatcherV1GetProfileForEvent(t *testing.T) {
ev := &utils.CGREvent{}
dPfl := &engine.DispatcherProfile{}
err := dsp.V1GetProfileForEvent(ev, dPfl)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if err == nil || err.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, err)
}
@@ -118,7 +118,7 @@ func TestDispatcherDispatch(t *testing.T) {
dsp := NewDispatcherService(nil, cfg, nil, nil)
ev := &utils.CGREvent{}
err := dsp.Dispatch(ev, "", "", "", "")
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if err == nil || err.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, err)
}
@@ -542,7 +542,7 @@ func TestDispatcherV1GetProfileForEventReturn(t *testing.T) {
}
dPfl := &engine.DispatcherProfile{}
err = dss.V1GetProfileForEvent(ev, dPfl)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if err != nil {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, err)
}
@@ -1006,12 +1006,16 @@ func TestDispatcherServiceDispatchDspErrHostNotFound2(t *testing.T) {
engine.Cache = cacheInit
}
*/
func TestDispatcherServiceDispatcherProfileForEventGetDispatcherError(t *testing.T) {
cfg := config.NewDefaultCGRConfig()
cfg.DispatcherSCfg().IndexedSelects = false
rpcCl := map[string]chan rpcclient.ClientConnector{}
connMng := engine.NewConnManager(cfg, rpcCl)
dm := engine.NewDataManager(&engine.DataDBMock{}, nil, connMng)
dataDB := engine.NewInternalDB(nil, nil, true)
dm := engine.NewDataManager(dataDB, nil, connMng)
dsp := &engine.DispatcherProfile{
Tenant: "cgrates.org",
ID: "123",
@@ -1061,5 +1065,3 @@ func TestDispatcherServiceDispatcherProfileForEventGetDispatcherError(t *testing
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", "NOT_FOUND:filter", err)
}
}
*/

View File

@@ -50,7 +50,7 @@ func TestGuardianGuardianSv1PingErr2(t *testing.T) {
}
var reply *string
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
result := dspSrv.GuardianSv1Ping(CGREvent, reply)
if result == nil || result.Error() != expected {
@@ -64,7 +64,7 @@ func TestGuardianGuardianSv1PingErrNil(t *testing.T) {
var CGREvent *utils.CGREvent
var reply *string
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
result := dspSrv.GuardianSv1Ping(CGREvent, reply)
if result == nil || result.Error() != expected {
@@ -97,7 +97,7 @@ func TestGuardianGuardianSv1RemoteLockErr2(t *testing.T) {
}
var reply *string
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
result := dspSrv.GuardianSv1RemoteLock(CGREvent, reply)
if result == nil || result.Error() != expected {
@@ -130,7 +130,7 @@ func TestGuardianGuardianSv1RemoteUnlockErr2(t *testing.T) {
}
var reply *[]string
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
result := dspSrv.GuardianSv1RemoteUnlock(CGREvent, reply)
if result == nil || result.Error() != expected {

View File

@@ -50,7 +50,7 @@ func TestRALsRALsV1PingErr2(t *testing.T) {
}
var reply *string
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
result := dspSrv.RALsV1Ping(CGREvent, reply)
if result == nil || result.Error() != expected {
@@ -94,7 +94,7 @@ func TestRALsRALsV1GetRatingPlansCostErr2(t *testing.T) {
CGREvent := &utils.RatingPlanCostArg{}
var reply *RatingPlanCost
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
result := dspSrv.RALsV1GetRatingPlansCost(CGREvent, reply)
if result == nil || result.Error() != expected {

File diff suppressed because it is too large Load Diff

View File

@@ -61,7 +61,7 @@ func TestDspResourceSv1PingErrorNil(t *testing.T) {
}
var reply *string
result := dspSrv.ResourceSv1Ping(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -94,7 +94,7 @@ func TestDspResourceSv1GetResourcesForEventErrorNil(t *testing.T) {
}
var reply *engine.Resources
result := dspSrv.ResourceSv1GetResourcesForEvent(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -127,7 +127,7 @@ func TestDspResourceSv1AuthorizeResourcesErrorNil(t *testing.T) {
}
var reply *string
result := dspSrv.ResourceSv1AuthorizeResources(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -160,7 +160,7 @@ func TestDspResourceSv1ReleaseResourcesErrorNil(t *testing.T) {
}
var reply *string
result := dspSrv.ResourceSv1ReleaseResources(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -193,7 +193,7 @@ func TestDspResourceSv1GetResourceErrorNil(t *testing.T) {
}
var reply *engine.Resource
result := dspSrv.ResourceSv1GetResource(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -226,7 +226,7 @@ func TestDspResourceSv1AllocateResourcesErrorNil(t *testing.T) {
}
var reply *string
result := dspSrv.ResourceSv1AllocateResources(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -259,7 +259,7 @@ func TestDspResourceSv1GetResourceWithConfigErrorNil(t *testing.T) {
}
var reply *engine.ResourceWithConfig
result := dspSrv.ResourceSv1GetResourceWithConfig(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}

View File

@@ -62,7 +62,7 @@ func TestDspResponderPingErrorNil(t *testing.T) {
}
var reply *string
result := dspSrv.ResponderPing(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -95,7 +95,7 @@ func TestDspResponderDebitErrorNil(t *testing.T) {
}
var reply *engine.CallCost
result := dspSrv.ResponderDebit(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -128,7 +128,7 @@ func TestDspResponderGetCostErrorNil(t *testing.T) {
}
var reply *engine.CallCost
result := dspSrv.ResponderGetCost(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -161,7 +161,7 @@ func TestDspResponderMaxDebitErrorNil(t *testing.T) {
}
var reply *engine.CallCost
result := dspSrv.ResponderMaxDebit(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -194,7 +194,7 @@ func TestDspResponderRefundIncrementsErrorNil(t *testing.T) {
}
var reply *engine.Account
result := dspSrv.ResponderRefundIncrements(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -227,7 +227,7 @@ func TestDspResponderRefundRoundingErrorNil(t *testing.T) {
}
var reply *float64
result := dspSrv.ResponderRefundRounding(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -260,7 +260,7 @@ func TestDspResponderGetMaxSessionTimeErrorNil(t *testing.T) {
}
var reply *time.Duration
result := dspSrv.ResponderGetMaxSessionTime(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -289,7 +289,7 @@ func TestDspResponderShutdownErrorNil(t *testing.T) {
}
var reply *string
result := dspSrv.ResponderShutdown(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}

View File

@@ -61,7 +61,7 @@ func TestDspRouteSv1PingErrorNil(t *testing.T) {
}
var reply *string
result := dspSrv.RouteSv1Ping(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -94,7 +94,7 @@ func TestDspRouteSv1GetRoutesErrorNil(t *testing.T) {
}
var reply *engine.SortedRoutesList
result := dspSrv.RouteSv1GetRoutes(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -127,7 +127,7 @@ func TestDspRouteSv1GetRoutesListErrorNil(t *testing.T) {
}
var reply *[]string
result := dspSrv.RouteSv1GetRoutesList(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -156,7 +156,7 @@ func TestDspRouteSv1GetRouteProfilesForEventErrorNil(t *testing.T) {
}
var reply *[]*engine.RouteProfile
result := dspSrv.RouteSv1GetRouteProfilesForEvent(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}

View File

@@ -60,7 +60,7 @@ func TestDspSchedulerSv1PingNil(t *testing.T) {
}
var reply *string
result := dspSrv.SchedulerSv1Ping(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -89,7 +89,7 @@ func TestDspSchedulerSv1ReloadPingNil(t *testing.T) {
}
var reply *string
result := dspSrv.SchedulerSv1Reload(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -118,7 +118,7 @@ func TestDspSchedulerSv1ExecuteActionsNil(t *testing.T) {
}
var reply *string
result := dspSrv.SchedulerSv1ExecuteActions(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -147,7 +147,7 @@ func TestDspSchedulerSv1ExecuteActionPlansNil(t *testing.T) {
}
var reply *string
result := dspSrv.SchedulerSv1ExecuteActionPlans(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}

View File

@@ -60,7 +60,7 @@ func TestDspServiceManagerV1PingNil(t *testing.T) {
}
var reply *string
result := dspSrv.ServiceManagerV1Ping(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -89,7 +89,7 @@ func TestDspServiceManagerV1StartServiceNil(t *testing.T) {
}
var reply *string
result := dspSrv.ServiceManagerV1StartService(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -118,7 +118,7 @@ func TestDspServiceManagerV1StopServiceNil(t *testing.T) {
}
var reply *string
result := dspSrv.ServiceManagerV1StopService(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -147,7 +147,7 @@ func TestDspServiceManagerV1ServiceStatusErrorNil(t *testing.T) {
}
var reply *string
result := dspSrv.ServiceManagerV1ServiceStatus(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}

View File

@@ -34,7 +34,7 @@ func TestDspSessionSv1PingNil(t *testing.T) {
}
var reply *string
result := dspSrv.SessionSv1Ping(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -65,7 +65,7 @@ func TestDspSessionSv1AuthorizeEventNil(t *testing.T) {
}
var reply *sessions.V1AuthorizeReply
result := dspSrv.SessionSv1AuthorizeEvent(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -98,7 +98,7 @@ func TestDspSessionSv1AuthorizeEventWithDigestNil(t *testing.T) {
}
var reply *sessions.V1AuthorizeReplyWithDigest
result := dspSrv.SessionSv1AuthorizeEventWithDigest(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -131,7 +131,7 @@ func TestDspSessionSv1InitiateSessionNil(t *testing.T) {
}
var reply *sessions.V1InitSessionReply
result := dspSrv.SessionSv1InitiateSession(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -164,7 +164,7 @@ func TestDspSessionSv1InitiateSessionWithDigestNil(t *testing.T) {
}
var reply *sessions.V1InitReplyWithDigest
result := dspSrv.SessionSv1InitiateSessionWithDigest(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -197,7 +197,7 @@ func TestDspSessionSv1UpdateSessionNil(t *testing.T) {
}
var reply *sessions.V1UpdateSessionReply
result := dspSrv.SessionSv1UpdateSession(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -228,7 +228,7 @@ func TestDspSessionSv1SyncSessionsNil(t *testing.T) {
}
var reply *string
result := dspSrv.SessionSv1SyncSessions(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -259,7 +259,7 @@ func TestDspSessionSv1TerminateSessionNil(t *testing.T) {
}
var reply *string
result := dspSrv.SessionSv1TerminateSession(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -290,7 +290,7 @@ func TestDspSessionSv1ProcessCDRNil(t *testing.T) {
}
var reply *string
result := dspSrv.SessionSv1ProcessCDR(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -321,7 +321,7 @@ func TestDspSessionSv1ProcessMessageNil(t *testing.T) {
}
var reply *sessions.V1ProcessMessageReply
result := dspSrv.SessionSv1ProcessMessage(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -354,7 +354,7 @@ func TestDspSessionSv1ProcessEventNil(t *testing.T) {
}
var reply *sessions.V1ProcessEventReply
result := dspSrv.SessionSv1ProcessEvent(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -387,7 +387,7 @@ func TestDspSessionSv1GetCostNil(t *testing.T) {
}
var reply *sessions.V1GetCostReply
result := dspSrv.SessionSv1GetCost(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -418,7 +418,7 @@ func TestDspSessionSv1GetActiveSessionsNil(t *testing.T) {
}
var reply *[]*sessions.ExternalSession
result := dspSrv.SessionSv1GetActiveSessions(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -447,7 +447,7 @@ func TestDspSessionSv1GetActiveSessionsCountNil(t *testing.T) {
}
var reply *int
result := dspSrv.SessionSv1GetActiveSessionsCount(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -476,7 +476,7 @@ func TestDspSessionSv1ForceDisconnectNil(t *testing.T) {
}
var reply *string
result := dspSrv.SessionSv1ForceDisconnect(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -505,7 +505,7 @@ func TestDspSessionSv1GetPassiveSessionsNil(t *testing.T) {
}
var reply *[]*sessions.ExternalSession
result := dspSrv.SessionSv1GetPassiveSessions(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -534,7 +534,7 @@ func TestDspSessionSv1ReplicateSessionsNil(t *testing.T) {
}
var reply *string
result := dspSrv.SessionSv1ReplicateSessions(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -563,7 +563,7 @@ func TestDspSessionSv1GetPassiveSessionsCountNil(t *testing.T) {
}
var reply *int
result := dspSrv.SessionSv1GetPassiveSessionsCount(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -592,7 +592,7 @@ func TestDspSessionSv1SetPassiveSessionNil(t *testing.T) {
}
var reply *string
result := dspSrv.SessionSv1SetPassiveSession(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -621,7 +621,7 @@ func TestDspSessionSv1ActivateSessionsNil(t *testing.T) {
}
var reply *string
result := dspSrv.SessionSv1ActivateSessions(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -650,7 +650,7 @@ func TestDspSessionSv1DeactivateSessionsNil(t *testing.T) {
}
var reply *string
result := dspSrv.SessionSv1DeactivateSessions(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -677,7 +677,7 @@ func TestDspSessionSv1STIRAuthenticateNil(t *testing.T) {
CGREvent := &sessions.V1STIRAuthenticateArgs{}
var reply *string
result := dspSrv.SessionSv1STIRAuthenticate(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -702,7 +702,7 @@ func TestDspSessionSv1STIRIdentityNil(t *testing.T) {
CGREvent := &sessions.V1STIRIdentityArgs{}
var reply *string
result := dspSrv.SessionSv1STIRIdentity(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}

View File

@@ -34,7 +34,7 @@ func TestDspStatSv1PingNil(t *testing.T) {
}
var reply *string
result := dspSrv.StatSv1Ping(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -77,7 +77,7 @@ func TestDspStatSv1GetStatQueuesForEventNil(t *testing.T) {
}
var reply *[]string
result := dspSrv.StatSv1GetStatQueuesForEvent(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -110,7 +110,7 @@ func TestDspStatSv1GetQueueStringMetricsNil(t *testing.T) {
}
var reply *map[string]string
result := dspSrv.StatSv1GetQueueStringMetrics(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -143,7 +143,7 @@ func TestDspStatSv1ProcessEventNil(t *testing.T) {
}
var reply *[]string
result := dspSrv.StatSv1ProcessEvent(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -176,7 +176,7 @@ func TestDspStatSv1GetQueueFloatMetricsNil(t *testing.T) {
}
var reply *map[string]float64
result := dspSrv.StatSv1GetQueueFloatMetrics(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -207,7 +207,7 @@ func TestDspStatSv1GetQueueIDsNil(t *testing.T) {
}
var reply *[]string
result := dspSrv.StatSv1GetQueueIDs(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}

View File

@@ -31,7 +31,7 @@ func TestDspThresholdSv1PingNilEvent(t *testing.T) {
dspSrv := NewDispatcherService(nil, cgrCfg, nil, nil)
var reply *string
result := dspSrv.ThresholdSv1Ping(nil, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -45,7 +45,7 @@ func TestDspThresholdSv1PingNil(t *testing.T) {
}
var reply *string
result := dspSrv.ThresholdSv1Ping(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -74,7 +74,7 @@ func TestDspThresholdSv1GetThresholdsForEventNil(t *testing.T) {
}
var reply *engine.Thresholds
result := dspSrv.ThresholdSv1GetThresholdsForEvent(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -107,7 +107,7 @@ func TestDspThresholdSv1ProcessEventNil(t *testing.T) {
}
var reply *[]string
result := dspSrv.ThresholdSv1ProcessEvent(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -138,7 +138,7 @@ func TestDspThresholdSv1GetThresholdIDsNil(t *testing.T) {
}
var reply *[]string
result := dspSrv.ThresholdSv1GetThresholdIDs(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}
@@ -169,7 +169,7 @@ func TestDspThresholdSv1GetThresholdNil(t *testing.T) {
}
var reply *engine.Threshold
result := dspSrv.ThresholdSv1GetThreshold(CGREvent, reply)
expected := "DISPATCHER_ERROR:NOT_FOUND"
expected := "DISPATCHER_ERROR:NO_DATABASE_CONNECTION"
if result == nil || result.Error() != expected {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
}

View File

@@ -646,10 +646,10 @@ func TestChargersprocessEvent(t *testing.T) {
},
}
experr := utils.ErrNotFound
experr := "NO_DATABASE_CONNECTION"
rcv, err := cS.processEvent(cgrEv.Tenant, cgrEv)
if err == nil || err != experr {
if err == nil || err.Error() != experr {
t.Fatalf("\nexpected: <%+v>, \nreceived: <%+v>", experr, err)
}

View File

@@ -97,6 +97,9 @@ func MatchingItemIDsForEvent(ev utils.MapStorage, stringFldIDs, prefixFldIDs, su
}
return
}, config.CgrConfig().GeneralCfg().LockingTimeout, lockID)
if err != nil {
return nil, err
}
if len(itemIDs) == 0 {
return nil, utils.ErrNotFound
}