mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 10:06:24 +05:00
Improving and fixing tests
This commit is contained in:
committed by
Dan Christian Bogos
parent
f1864b648b
commit
763310e46c
@@ -23,6 +23,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/cgrates/cgrates/config"
|
||||
"github.com/cgrates/cgrates/engine"
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
"github.com/cgrates/ltcache"
|
||||
)
|
||||
@@ -479,3 +480,42 @@ func TestDspCacheSv1ReplicateSetNil(t *testing.T) {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDspCacheSv1GetItemWithRemote(t *testing.T) {
|
||||
cfg := config.NewDefaultCGRConfig()
|
||||
db := engine.NewInternalDB(nil, nil, true, cfg.DataDbCfg().Items)
|
||||
dm := engine.NewDataManager(db, cfg.CacheCfg(), nil)
|
||||
dsp := NewDispatcherService(dm, cfg, engine.NewFilterS(cfg, nil, dm), nil)
|
||||
args := &utils.ArgsGetCacheItemWithAPIOpts{
|
||||
Tenant: "cgrates.org",
|
||||
ArgsGetCacheItem: utils.ArgsGetCacheItem{
|
||||
CacheID: utils.CacheChargerProfiles,
|
||||
ItemID: "cgrates.org:DISP1 ",
|
||||
},
|
||||
APIOpts: map[string]any{
|
||||
"Opt": "Disp",
|
||||
},
|
||||
}
|
||||
if err := dm.SetDispatcherProfile(&engine.DispatcherProfile{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "DSP_Test1",
|
||||
FilterIDs: []string{"*string:~*opts.Opt:Disp"},
|
||||
Strategy: utils.MetaRoundRobin,
|
||||
Subsystems: []string{utils.MetaAny},
|
||||
Hosts: engine.DispatcherHostProfiles{
|
||||
&engine.DispatcherHostProfile{
|
||||
ID: "ALL2",
|
||||
FilterIDs: []string{},
|
||||
Weight: 20,
|
||||
Params: make(map[string]any),
|
||||
},
|
||||
},
|
||||
Weight: 20,
|
||||
}, true); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
var reply any
|
||||
if err := dsp.CacheSv1GetItemWithRemote(args, &reply); err == nil { //not finished
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user