Covered ratescfg to 100%

This commit is contained in:
porosnicuadrian
2020-10-07 09:40:02 +03:00
committed by Dan Christian Bogos
parent a69826cb72
commit 1be2f90dad

View File

@@ -29,10 +29,12 @@ func TestRateSConfigloadFromJsonCfg(t *testing.T) {
cfgJSON := &RateSJsonCfg{
Enabled: utils.BoolPointer(true),
Indexed_selects: utils.BoolPointer(true),
String_indexed_fields: &[]string{"*req.index1"},
Prefix_indexed_fields: &[]string{"*req.index1"},
Suffix_indexed_fields: &[]string{"*req.index1"},
Nested_fields: utils.BoolPointer(true),
Rate_indexed_selects: utils.BoolPointer(true),
Rate_string_indexed_fields: &[]string{"*req.index1"},
Rate_prefix_indexed_fields: &[]string{"*req.index1"},
Rate_suffix_indexed_fields: &[]string{"*req.index1"},
Rate_nested_fields: utils.BoolPointer(true),
@@ -40,10 +42,12 @@ func TestRateSConfigloadFromJsonCfg(t *testing.T) {
expected := &RateSCfg{
Enabled: true,
IndexedSelects: true,
StringIndexedFields: &[]string{"*req.index1"},
PrefixIndexedFields: &[]string{"*req.index1"},
SuffixIndexedFields: &[]string{"*req.index1"},
NestedFields: true,
RateIndexedSelects: true,
RateStringIndexedFields: &[]string{"*req.index1"},
RatePrefixIndexedFields: &[]string{"*req.index1"},
RateSuffixIndexedFields: &[]string{"*req.index1"},
RateNestedFields: true,
@@ -84,12 +88,12 @@ func TestRatesCfgAsMapInterface1(t *testing.T) {
"rates": {
"enabled": true,
"indexed_selects": false,
//"string_indexed_fields": [],
"string_indexed_fields": ["*req.index1"],
"prefix_indexed_fields": ["*req.index1", "*req.index2"],
"suffix_indexed_fields": ["*req.index1"],
"nested_fields": true,
"rate_indexed_selects": false,
//"rate_string_indexed_fields": [],
"rate_string_indexed_fields": ["*req.index1"],
"rate_prefix_indexed_fields": ["*req.index1", "*req.index2"],
"rate_suffix_indexed_fields": ["*req.index1", "*req.index2", "*req.index3"],
"rate_nested_fields": true,
@@ -98,10 +102,12 @@ func TestRatesCfgAsMapInterface1(t *testing.T) {
eMap := map[string]interface{}{
utils.EnabledCfg: true,
utils.IndexedSelectsCfg: false,
utils.StringIndexedFieldsCfg: []string{"*req.index1"},
utils.PrefixIndexedFieldsCfg: []string{"*req.index1", "*req.index2"},
utils.SuffixIndexedFieldsCfg: []string{"*req.index1"},
utils.NestedFieldsCfg: true,
utils.RateIndexedSelectsCfg: false,
utils.RateStringIndexedFieldsCfg: []string{"*req.index1"},
utils.RatePrefixIndexedFieldsCfg: []string{"*req.index1", "*req.index2"},
utils.RateSuffixIndexedFieldsCfg: []string{"*req.index1", "*req.index2", "*req.index3"},
utils.RateNestedFieldsCfg: true,