mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Add new unit tests on engine
This commit is contained in:
committed by
Dan Christian Bogos
parent
c3a2a12089
commit
9ba8feeb71
@@ -1032,3 +1032,39 @@ func TestCacheSBeginTransaction(t *testing.T) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestCachesV1ReLoadCache(t *testing.T) {
|
||||
cfg := config.NewDefaultCGRConfig()
|
||||
tmpDm := dm
|
||||
defer func() {
|
||||
dm = tmpDm
|
||||
}()
|
||||
attr := &utils.AttrReloadCacheWithAPIOpts{
|
||||
Tenant: "cgrates.org",
|
||||
FilterIDs: []string{"cgrates.org:FLTR_ID"},
|
||||
AttributeFilterIndexIDs: []string{"cgrates.org:*any:*string:*req.Account:1001", "cgrates.org:*any:*string:*req.Account:1002"},
|
||||
}
|
||||
chS := NewCacheS(cfg, dm, nil)
|
||||
var reply string
|
||||
if err := chS.V1ReloadCache(context.Background(), attr, &reply); err != nil {
|
||||
t.Error(err)
|
||||
} else if reply != utils.OK {
|
||||
t.Errorf("reply should be %v", utils.OK)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestCachesCall(t *testing.T) {
|
||||
chS := CacheS{}
|
||||
|
||||
ctx := context.Background()
|
||||
serviceMethod := "Method"
|
||||
args := "Args"
|
||||
reply := "Reply"
|
||||
|
||||
err := chS.Call(ctx, serviceMethod, args, reply)
|
||||
|
||||
if err == nil {
|
||||
t.Errorf("Call returned an unexpected error: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ import (
|
||||
"github.com/cgrates/birpc"
|
||||
"github.com/cgrates/birpc/context"
|
||||
"github.com/cgrates/cgrates/config"
|
||||
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
)
|
||||
|
||||
@@ -3374,3 +3375,26 @@ func TestStatQueueProcessEventErr(t *testing.T) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestStatServiceCall(t *testing.T) {
|
||||
|
||||
tDM := &DataManager{}
|
||||
tConnMgr := &ConnManager{}
|
||||
tFilterS := &FilterS{}
|
||||
tCGRConfig := &config.CGRConfig{}
|
||||
statService := &StatService{
|
||||
dm: tDM,
|
||||
connMgr: tConnMgr,
|
||||
filterS: tFilterS,
|
||||
cgrcfg: tCGRConfig,
|
||||
}
|
||||
ctx := context.Background()
|
||||
serviceMethod := ""
|
||||
args := ""
|
||||
reply := ""
|
||||
err := statService.Call(ctx, serviceMethod, args, &reply)
|
||||
if err == nil {
|
||||
t.Errorf("Call method returned error: %v", err)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user