Revise/add unit tests after sentrypeer addition

This commit is contained in:
ionutboangiu
2023-07-20 12:20:11 -04:00
committed by Dan Christian Bogos
parent 20afc011fb
commit e5b7b91799
5 changed files with 23 additions and 10 deletions

View File

@@ -61,14 +61,12 @@ func TestAPIBanCfgAsMapInterface(t *testing.T) {
var alS APIBanCfg
cfgJSONStr := `{
"apiban":{
"enabled":false,
"keys": ["key1","key2"]
},
}`
eMap := map[string]any{
"enabled": false,
"keys": []string{"key1", "key2"},
"keys": []string{"key1", "key2"},
}
if jsnCfg, err := NewCgrJsonCfgFromBytes([]byte(cfgJSONStr)); err != nil {
t.Error(err)

View File

@@ -1264,9 +1264,9 @@ const CGRATES_CFG_JSON = `
"apiban": {
"enabled": false,
"keys": [],
},
"sentrypeer":{
"client_id":"",
"client_secret":"",

View File

@@ -223,6 +223,9 @@ func TestCacheJsonCfg(t *testing.T) {
utils.MetaAPIBan: {Limit: utils.IntPointer(-1),
Ttl: utils.StringPointer("2m"), Static_ttl: utils.BoolPointer(false),
Remote: utils.BoolPointer(false), Replicate: utils.BoolPointer(false)},
utils.MetaSentryPeer: {Limit: utils.IntPointer(-1),
Ttl: utils.StringPointer("86400s"), Static_ttl: utils.BoolPointer(true),
Remote: utils.BoolPointer(false), Replicate: utils.BoolPointer(false)},
utils.CacheReplicationHosts: {Limit: utils.IntPointer(0),
Ttl: utils.StringPointer(""), Static_ttl: utils.BoolPointer(false),
Remote: utils.BoolPointer(false), Replicate: utils.BoolPointer(false)},

File diff suppressed because one or more lines are too long

View File

@@ -1005,7 +1005,7 @@ func TestNewAttrReloadCacheWithOpts(t *testing.T) {
}
func TestNewAttrReloadCacheWithOptsFromMap(t *testing.T) {
excluded := NewStringSet([]string{MetaAPIBan, MetaAccounts, MetaLoadIDs})
excluded := NewStringSet([]string{MetaAPIBan, MetaSentryPeer, MetaAccounts, MetaLoadIDs})
mp := make(map[string][]string)
for k := range CacheInstanceToPrefix {
if !excluded.Has(k) {