mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Optimize AgentRequest test (2s->0.03s)
Lowering the cfg cache TTL to 5ms instead of 1s was enough to get consistent results.
This commit is contained in:
committed by
Dan Christian Bogos
parent
2d141c642a
commit
04bff19ced
@@ -2130,7 +2130,7 @@ func TestAgReqSetFieldsInCacheWithTimeOut(t *testing.T) {
|
||||
dm := engine.NewDataManager(data, config.CgrConfig().CacheCfg(), nil)
|
||||
filterS := engine.NewFilterS(cfg, nil, dm)
|
||||
|
||||
cfg.CacheCfg().Partitions[utils.CacheUCH].TTL = time.Second
|
||||
cfg.CacheCfg().Partitions[utils.CacheUCH].TTL = 5 * time.Millisecond
|
||||
engine.Cache = engine.NewCacheS(cfg, dm, nil)
|
||||
agReq := NewAgentRequest(nil, nil, nil, nil, nil, nil, "cgrates.org", "", filterS, nil)
|
||||
agReq.CGRRequest.Set(&utils.FullPath{Path: utils.AccountField, PathSlice: []string{utils.AccountField}}, utils.NewLeafNode("1001"))
|
||||
@@ -2166,7 +2166,7 @@ func TestAgReqSetFieldsInCacheWithTimeOut(t *testing.T) {
|
||||
t.Error(err)
|
||||
}
|
||||
// give enough time to Cache to remove ttl the *uch
|
||||
time.Sleep(2 * time.Second)
|
||||
time.Sleep(6 * time.Millisecond)
|
||||
if _, err := agReq.FieldAsInterface([]string{utils.MetaUCH, utils.Tenant}); err == nil || err != utils.ErrNotFound {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user