mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-13 02:56:24 +05:00
Add nil verifications for jsnCfg opts in load functions and fix tests
This commit is contained in:
committed by
Dan Christian Bogos
parent
9888feea81
commit
8cb46adfa5
@@ -226,11 +226,15 @@ func testCfgSetGetConfig(t *testing.T) {
|
||||
"stats_conns": []string{"*internal"},
|
||||
"suffix_indexed_fields": []string{},
|
||||
utils.OptsCfg: map[string]interface{}{
|
||||
utils.MetaAttributeIDsCfg: map[string][]string{},
|
||||
utils.MetaAttributeIDsCfg: map[string][]string{
|
||||
utils.EmptyString: {},
|
||||
},
|
||||
utils.MetaProcessRunsCfg: map[string]int{
|
||||
utils.EmptyString: 2,
|
||||
},
|
||||
utils.MetaProfileRunsCfg: map[string]int{},
|
||||
utils.MetaProfileRunsCfg: map[string]int{
|
||||
utils.EmptyString: 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -342,7 +346,7 @@ func testCfgSetJSONGetJSONConfig(t *testing.T) {
|
||||
if !reflect.DeepEqual(`"OK"`, utils.ToJSON(reply)) {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", "OK", utils.ToJSON(reply))
|
||||
}
|
||||
expectedGet := "{\"attributes\":{\"accounts_conns\":[\"*internal\"],\"enabled\":true,\"indexed_selects\":false,\"nested_fields\":false,\"opts\":{\"*attributeIDs\":{},\"*processRuns\":{\"\":2},\"*profileRuns\":{}},\"prefix_indexed_fields\":[],\"resources_conns\":[\"*internal\"],\"stats_conns\":[\"*localhost\"],\"suffix_indexed_fields\":[]}}"
|
||||
expectedGet := "{\"attributes\":{\"accounts_conns\":[\"*internal\"],\"enabled\":true,\"indexed_selects\":false,\"nested_fields\":false,\"opts\":{\"*attributeIDs\":{\"\":[]},\"*processRuns\":{\"\":2},\"*profileRuns\":{\"\":0}},\"prefix_indexed_fields\":[],\"resources_conns\":[\"*internal\"],\"stats_conns\":[\"*localhost\"],\"suffix_indexed_fields\":[]}}"
|
||||
var replyGet string
|
||||
if err := cfgRPC.Call(context.Background(), utils.ConfigSv1GetConfigAsJSON,
|
||||
&config.SectionWithAPIOpts{
|
||||
@@ -512,11 +516,15 @@ func testCfgSetGetConfigStore(t *testing.T) {
|
||||
"stats_conns": []string{"*internal"},
|
||||
"suffix_indexed_fields": []string{},
|
||||
utils.OptsCfg: map[string]interface{}{
|
||||
utils.MetaAttributeIDsCfg: map[string][]string{},
|
||||
utils.MetaAttributeIDsCfg: map[string][]string{
|
||||
utils.EmptyString: {},
|
||||
},
|
||||
utils.MetaProcessRunsCfg: map[string]int{
|
||||
utils.EmptyString: 2,
|
||||
},
|
||||
utils.MetaProfileRunsCfg: map[string]int{},
|
||||
utils.MetaProfileRunsCfg: map[string]int{
|
||||
utils.EmptyString: 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -551,11 +559,9 @@ func testCfgGetConfigStoreAgain(t *testing.T) {
|
||||
Suffix_indexed_fields: nil,
|
||||
Nested_fields: nil,
|
||||
Opts: &config.AttributesOptsJson{
|
||||
AttributeIDs: map[string][]string{},
|
||||
ProcessRuns: map[string]int{
|
||||
utils.EmptyString: 2,
|
||||
},
|
||||
ProfileRuns: map[string]int{},
|
||||
},
|
||||
}
|
||||
if !reflect.DeepEqual(attr, expected) {
|
||||
@@ -616,11 +622,15 @@ func testCfgGetAfterReloadStore(t *testing.T) {
|
||||
"stats_conns": []string{"*internal"},
|
||||
"suffix_indexed_fields": []string{},
|
||||
utils.OptsCfg: map[string]interface{}{
|
||||
utils.MetaAttributeIDsCfg: map[string][]string{},
|
||||
utils.MetaAttributeIDsCfg: map[string][]string{
|
||||
utils.EmptyString: {},
|
||||
},
|
||||
utils.MetaProcessRunsCfg: map[string]int{
|
||||
utils.EmptyString: 2,
|
||||
},
|
||||
utils.MetaProfileRunsCfg: map[string]int{},
|
||||
utils.MetaProfileRunsCfg: map[string]int{
|
||||
utils.EmptyString: 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -44,17 +44,6 @@ type AccountSCfg struct {
|
||||
Opts *AccountsOpts
|
||||
}
|
||||
|
||||
func (accOpts *AccountsOpts) loadFromJSONCfg(jsnCfg *AccountsOptsJson) (err error) {
|
||||
if jsnCfg == nil {
|
||||
return nil
|
||||
}
|
||||
accOpts.AccountIDs = utils.MapToDynamicStringSliceOpts(jsnCfg.AccountIDs)
|
||||
if accOpts.Usage, err = utils.MapToDynamicDecimalBigOpts(jsnCfg.Usage); err != nil {
|
||||
return
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// loadAccountSCfg loads the AccountS section of the configuration
|
||||
func (acS *AccountSCfg) Load(ctx *context.Context, jsnCfg ConfigDB, _ *CGRConfig) (err error) {
|
||||
jsnActionCfg := new(AccountSJsonCfg)
|
||||
@@ -64,6 +53,21 @@ func (acS *AccountSCfg) Load(ctx *context.Context, jsnCfg ConfigDB, _ *CGRConfig
|
||||
return acS.loadFromJSONCfg(jsnActionCfg)
|
||||
}
|
||||
|
||||
func (accOpts *AccountsOpts) loadFromJSONCfg(jsnCfg *AccountsOptsJson) (err error) {
|
||||
if jsnCfg == nil {
|
||||
return
|
||||
}
|
||||
if jsnCfg.AccountIDs != nil {
|
||||
accOpts.AccountIDs = utils.MapToDynamicStringSliceOpts(jsnCfg.AccountIDs)
|
||||
}
|
||||
if jsnCfg.Usage != nil {
|
||||
if accOpts.Usage, err = utils.MapToDynamicDecimalBigOpts(jsnCfg.Usage); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (acS *AccountSCfg) loadFromJSONCfg(jsnCfg *AccountSJsonCfg) (err error) {
|
||||
if jsnCfg == nil {
|
||||
return
|
||||
@@ -104,7 +108,7 @@ func (acS *AccountSCfg) loadFromJSONCfg(jsnCfg *AccountSJsonCfg) (err error) {
|
||||
}
|
||||
}
|
||||
if jsnCfg.Opts != nil {
|
||||
acS.Opts.loadFromJSONCfg(jsnCfg.Opts)
|
||||
err = acS.Opts.loadFromJSONCfg(jsnCfg.Opts)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@@ -54,13 +54,13 @@ func (acS *ActionSCfg) Load(ctx *context.Context, jsnCfg ConfigDB, _ *CGRConfig)
|
||||
return acS.loadFromJSONCfg(jsnActionCfg)
|
||||
}
|
||||
|
||||
func (actOpts *ActionsOpts) loadFromJSONCfg(jsnCfg *ActionsOptsJson) (err error) {
|
||||
func (actOpts *ActionsOpts) loadFromJSONCfg(jsnCfg *ActionsOptsJson) {
|
||||
if jsnCfg == nil {
|
||||
return nil
|
||||
return
|
||||
}
|
||||
if jsnCfg.ActionProfileIDs != nil {
|
||||
actOpts.ActionProfileIDs = utils.MapToDynamicStringSliceOpts(jsnCfg.ActionProfileIDs)
|
||||
}
|
||||
actOpts.ActionProfileIDs = utils.MapToDynamicStringSliceOpts(jsnCfg.ActionProfileIDs)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (acS *ActionSCfg) loadFromJSONCfg(jsnCfg *ActionSJsonCfg) (err error) {
|
||||
|
||||
@@ -43,16 +43,6 @@ type AttributeSCfg struct {
|
||||
Opts *AttributesOpts
|
||||
}
|
||||
|
||||
func (attrOpts *AttributesOpts) loadFromJSONCfg(jsnCfg *AttributesOptsJson) (err error) {
|
||||
if jsnCfg == nil {
|
||||
return
|
||||
}
|
||||
attrOpts.AttributeIDs = utils.MapToDynamicStringSliceOpts(jsnCfg.AttributeIDs)
|
||||
attrOpts.ProcessRuns = utils.MapToDynamicIntOpts(jsnCfg.ProcessRuns)
|
||||
attrOpts.ProfileRuns = utils.MapToDynamicIntOpts(jsnCfg.ProfileRuns)
|
||||
return
|
||||
}
|
||||
|
||||
// loadAttributeSCfg loads the AttributeS section of the configuration
|
||||
func (alS *AttributeSCfg) Load(ctx *context.Context, jsnCfg ConfigDB, _ *CGRConfig) (err error) {
|
||||
jsnAttributeSCfg := new(AttributeSJsonCfg)
|
||||
@@ -62,6 +52,21 @@ func (alS *AttributeSCfg) Load(ctx *context.Context, jsnCfg ConfigDB, _ *CGRConf
|
||||
return alS.loadFromJSONCfg(jsnAttributeSCfg)
|
||||
}
|
||||
|
||||
func (attrOpts *AttributesOpts) loadFromJSONCfg(jsnCfg *AttributesOptsJson) {
|
||||
if jsnCfg == nil {
|
||||
return
|
||||
}
|
||||
if jsnCfg.AttributeIDs != nil {
|
||||
attrOpts.AttributeIDs = utils.MapToDynamicStringSliceOpts(jsnCfg.AttributeIDs)
|
||||
}
|
||||
if jsnCfg.ProcessRuns != nil {
|
||||
attrOpts.ProcessRuns = utils.MapToDynamicIntOpts(jsnCfg.ProcessRuns)
|
||||
}
|
||||
if jsnCfg.ProfileRuns != nil {
|
||||
attrOpts.ProfileRuns = utils.MapToDynamicIntOpts(jsnCfg.ProfileRuns)
|
||||
}
|
||||
}
|
||||
|
||||
func (alS *AttributeSCfg) loadFromJSONCfg(jsnCfg *AttributeSJsonCfg) (err error) {
|
||||
if jsnCfg == nil {
|
||||
return
|
||||
|
||||
@@ -99,11 +99,15 @@ func TestAttributeSCfgAsMapInterface(t *testing.T) {
|
||||
utils.NestedFieldsCfg: false,
|
||||
utils.SuffixIndexedFieldsCfg: []string{},
|
||||
utils.OptsCfg: map[string]interface{}{
|
||||
utils.MetaAttributeIDsCfg: map[string][]string{},
|
||||
utils.MetaAttributeIDsCfg: map[string][]string{
|
||||
utils.EmptyString: {},
|
||||
},
|
||||
utils.MetaProcessRunsCfg: map[string]int{
|
||||
utils.EmptyString: 3,
|
||||
},
|
||||
utils.MetaProfileRunsCfg: map[string]int{},
|
||||
utils.MetaProfileRunsCfg: map[string]int{
|
||||
utils.EmptyString: 0,
|
||||
},
|
||||
},
|
||||
}
|
||||
if cgrCfg, err := NewCGRConfigFromJSONStringWithDefaults(cfgJSONStr); err != nil {
|
||||
@@ -136,11 +140,15 @@ func TestAttributeSCfgAsMapInterface2(t *testing.T) {
|
||||
utils.SuffixIndexedFieldsCfg: []string{"*req.index1", "*req.index2"},
|
||||
utils.NestedFieldsCfg: true,
|
||||
utils.OptsCfg: map[string]interface{}{
|
||||
utils.MetaAttributeIDsCfg: map[string][]string{},
|
||||
utils.MetaAttributeIDsCfg: map[string][]string{
|
||||
"": {},
|
||||
},
|
||||
utils.MetaProcessRunsCfg: map[string]int{
|
||||
utils.EmptyString: 7,
|
||||
},
|
||||
utils.MetaProfileRunsCfg: map[string]int{},
|
||||
utils.MetaProfileRunsCfg: map[string]int{
|
||||
utils.EmptyString: 0,
|
||||
},
|
||||
},
|
||||
}
|
||||
if cgrCfg, err := NewCGRConfigFromJSONStringWithDefaults(cfgJSONStr); err != nil {
|
||||
|
||||
@@ -6204,13 +6204,11 @@ func TestReloadCfgInDb(t *testing.T) {
|
||||
SuffixIndexedFields: &[]string{"field2"},
|
||||
PrefixIndexedFields: &[]string{"field2"},
|
||||
Opts: &AttributesOpts{
|
||||
AttributeIDs: []*utils.DynamicStringSliceOpt{},
|
||||
ProcessRuns: []*utils.DynamicIntOpt{
|
||||
{
|
||||
Value: 3,
|
||||
},
|
||||
},
|
||||
ProfileRuns: []*utils.DynamicIntOpt{},
|
||||
},
|
||||
NestedFields: false,
|
||||
}
|
||||
|
||||
@@ -58,17 +58,25 @@ func (rCfg *RateSCfg) Load(ctx *context.Context, jsnCfg ConfigDB, _ *CGRConfig)
|
||||
|
||||
func (rateOpts *RatesOpts) loadFromJSONCfg(jsnCfg *RatesOptsJson) (err error) {
|
||||
if jsnCfg == nil {
|
||||
return nil
|
||||
}
|
||||
rateOpts.RateProfileIDs = utils.MapToDynamicStringSliceOpts(jsnCfg.RateProfileIDs)
|
||||
rateOpts.StartTime = utils.MapToDynamicStringOpts(jsnCfg.StartTime)
|
||||
if rateOpts.Usage, err = utils.MapToDynamicDecimalBigOpts(jsnCfg.Usage); err != nil {
|
||||
return
|
||||
}
|
||||
if rateOpts.IntervalStart, err = utils.MapToDynamicDecimalBigOpts(jsnCfg.IntervalStart); err != nil {
|
||||
return
|
||||
if jsnCfg.RateProfileIDs != nil {
|
||||
rateOpts.RateProfileIDs = utils.MapToDynamicStringSliceOpts(jsnCfg.RateProfileIDs)
|
||||
}
|
||||
return nil
|
||||
if jsnCfg.StartTime != nil {
|
||||
rateOpts.StartTime = utils.MapToDynamicStringOpts(jsnCfg.StartTime)
|
||||
}
|
||||
if jsnCfg.Usage != nil {
|
||||
if rateOpts.Usage, err = utils.MapToDynamicDecimalBigOpts(jsnCfg.Usage); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
if jsnCfg.IntervalStart != nil {
|
||||
if rateOpts.IntervalStart, err = utils.MapToDynamicDecimalBigOpts(jsnCfg.IntervalStart); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (rCfg *RateSCfg) loadFromJSONCfg(jsnCfg *RateSJsonCfg) (err error) {
|
||||
@@ -113,7 +121,7 @@ func (rCfg *RateSCfg) loadFromJSONCfg(jsnCfg *RateSJsonCfg) (err error) {
|
||||
rCfg.Verbosity = *jsnCfg.Verbosity
|
||||
}
|
||||
if jsnCfg.Opts != nil {
|
||||
rCfg.Opts.loadFromJSONCfg(jsnCfg.Opts)
|
||||
err = rCfg.Opts.loadFromJSONCfg(jsnCfg.Opts)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@@ -55,20 +55,25 @@ func (rlcfg *ResourceSConfig) Load(ctx *context.Context, jsnCfg ConfigDB, _ *CGR
|
||||
|
||||
func (rsOpts *ResourcesOpts) loadFromJSONCfg(jsnCfg *ResourcesOptsJson) (err error) {
|
||||
if jsnCfg == nil {
|
||||
return nil
|
||||
}
|
||||
rsOpts.UsageID = utils.MapToDynamicStringOpts(jsnCfg.UsageID)
|
||||
if rsOpts.UsageTTL, err = utils.MapToDynamicDurationOpts(jsnCfg.UsageTTL); err != nil {
|
||||
return
|
||||
}
|
||||
rsOpts.Units = utils.MapToDynamicFloat64Opts(jsnCfg.Units)
|
||||
|
||||
return nil
|
||||
if jsnCfg.UsageID != nil {
|
||||
rsOpts.UsageID = utils.MapToDynamicStringOpts(jsnCfg.UsageID)
|
||||
}
|
||||
if jsnCfg.UsageTTL != nil {
|
||||
if rsOpts.UsageTTL, err = utils.MapToDynamicDurationOpts(jsnCfg.UsageTTL); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
if jsnCfg.Units != nil {
|
||||
rsOpts.Units = utils.MapToDynamicFloat64Opts(jsnCfg.Units)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (rlcfg *ResourceSConfig) loadFromJSONCfg(jsnCfg *ResourceSJsonCfg) (err error) {
|
||||
if jsnCfg == nil {
|
||||
return nil
|
||||
return
|
||||
}
|
||||
if jsnCfg.Enabled != nil {
|
||||
rlcfg.Enabled = *jsnCfg.Enabled
|
||||
@@ -97,9 +102,9 @@ func (rlcfg *ResourceSConfig) loadFromJSONCfg(jsnCfg *ResourceSJsonCfg) (err err
|
||||
rlcfg.NestedFields = *jsnCfg.Nested_fields
|
||||
}
|
||||
if jsnCfg.Opts != nil {
|
||||
rlcfg.Opts.loadFromJSONCfg(jsnCfg.Opts)
|
||||
err = rlcfg.Opts.loadFromJSONCfg(jsnCfg.Opts)
|
||||
}
|
||||
return nil
|
||||
return
|
||||
}
|
||||
|
||||
// AsMapInterface returns the config as a map[string]interface{}
|
||||
|
||||
@@ -49,21 +49,6 @@ type RouteSCfg struct {
|
||||
Opts *RoutesOpts
|
||||
}
|
||||
|
||||
func (rtsOpts *RoutesOpts) loadFromJSONCfg(jsnCfg *RoutesOptsJson) (err error) {
|
||||
if jsnCfg == nil {
|
||||
return
|
||||
}
|
||||
|
||||
rtsOpts.Context = utils.MapToDynamicStringOpts(jsnCfg.Context)
|
||||
rtsOpts.IgnoreErrors = utils.MapToDynamicBoolOpts(jsnCfg.IgnoreErrors)
|
||||
rtsOpts.MaxCost = utils.MapToDynamicInterfaceOpts(jsnCfg.MaxCost)
|
||||
rtsOpts.Limit = utils.MapToDynamicIntOpts(jsnCfg.Limit)
|
||||
rtsOpts.Offset = utils.MapToDynamicIntOpts(jsnCfg.Offset)
|
||||
rtsOpts.ProfileCount = utils.MapToDynamicIntOpts(jsnCfg.ProfileCount)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// loadRouteSCfg loads the RouteS section of the configuration
|
||||
func (rts *RouteSCfg) Load(ctx *context.Context, jsnCfg ConfigDB, _ *CGRConfig) (err error) {
|
||||
jsnRouteSCfg := new(RouteSJsonCfg)
|
||||
@@ -73,6 +58,30 @@ func (rts *RouteSCfg) Load(ctx *context.Context, jsnCfg ConfigDB, _ *CGRConfig)
|
||||
return rts.loadFromJSONCfg(jsnRouteSCfg)
|
||||
}
|
||||
|
||||
func (rtsOpts *RoutesOpts) loadFromJSONCfg(jsnCfg *RoutesOptsJson) {
|
||||
if jsnCfg == nil {
|
||||
return
|
||||
}
|
||||
if jsnCfg.Context != nil {
|
||||
rtsOpts.Context = utils.MapToDynamicStringOpts(jsnCfg.Context)
|
||||
}
|
||||
if jsnCfg.IgnoreErrors != nil {
|
||||
rtsOpts.IgnoreErrors = utils.MapToDynamicBoolOpts(jsnCfg.IgnoreErrors)
|
||||
}
|
||||
if jsnCfg.MaxCost != nil {
|
||||
rtsOpts.MaxCost = utils.MapToDynamicInterfaceOpts(jsnCfg.MaxCost)
|
||||
}
|
||||
if jsnCfg.Limit != nil {
|
||||
rtsOpts.Limit = utils.MapToDynamicIntOpts(jsnCfg.Limit)
|
||||
}
|
||||
if jsnCfg.Offset != nil {
|
||||
rtsOpts.Offset = utils.MapToDynamicIntOpts(jsnCfg.Offset)
|
||||
}
|
||||
if jsnCfg.ProfileCount != nil {
|
||||
rtsOpts.ProfileCount = utils.MapToDynamicIntOpts(jsnCfg.ProfileCount)
|
||||
}
|
||||
}
|
||||
|
||||
func (rts *RouteSCfg) loadFromJSONCfg(jsnCfg *RouteSJsonCfg) (err error) {
|
||||
if jsnCfg == nil {
|
||||
return
|
||||
|
||||
@@ -52,12 +52,13 @@ func (st *StatSCfg) Load(ctx *context.Context, jsnCfg ConfigDB, _ *CGRConfig) (e
|
||||
return st.loadFromJSONCfg(jsnStatSCfg)
|
||||
}
|
||||
|
||||
func (sqOpts *StatsOpts) loadFromJSONCfg(jsnCfg *StatsOptsJson) (err error) {
|
||||
func (sqOpts *StatsOpts) loadFromJSONCfg(jsnCfg *StatsOptsJson) {
|
||||
if jsnCfg == nil {
|
||||
return nil
|
||||
return
|
||||
}
|
||||
if jsnCfg.StatIDs != nil {
|
||||
sqOpts.StatIDs = utils.MapToDynamicStringSliceOpts(jsnCfg.StatIDs)
|
||||
}
|
||||
sqOpts.StatIDs = utils.MapToDynamicStringSliceOpts(jsnCfg.StatIDs)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (st *StatSCfg) loadFromJSONCfg(jsnCfg *StatServJsonCfg) (err error) {
|
||||
|
||||
@@ -42,15 +42,6 @@ type ThresholdSCfg struct {
|
||||
Opts *ThresholdsOpts
|
||||
}
|
||||
|
||||
func (thdOpts *ThresholdsOpts) loadFromJSONCfg(jsnCfg *ThresholdsOptsJson) (err error) {
|
||||
if jsnCfg == nil {
|
||||
return nil
|
||||
}
|
||||
thdOpts.ThresholdIDs = utils.MapToDynamicStringSliceOpts(jsnCfg.ThresholdIDs)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// loadThresholdSCfg loads the ThresholdS section of the configuration
|
||||
func (t *ThresholdSCfg) Load(ctx *context.Context, jsnCfg ConfigDB, _ *CGRConfig) (err error) {
|
||||
jsnThresholdSCfg := new(ThresholdSJsonCfg)
|
||||
@@ -60,6 +51,15 @@ func (t *ThresholdSCfg) Load(ctx *context.Context, jsnCfg ConfigDB, _ *CGRConfig
|
||||
return t.loadFromJSONCfg(jsnThresholdSCfg)
|
||||
}
|
||||
|
||||
func (thdOpts *ThresholdsOpts) loadFromJSONCfg(jsnCfg *ThresholdsOptsJson) {
|
||||
if jsnCfg == nil {
|
||||
return
|
||||
}
|
||||
if jsnCfg.ThresholdIDs != nil {
|
||||
thdOpts.ThresholdIDs = utils.MapToDynamicStringSliceOpts(jsnCfg.ThresholdIDs)
|
||||
}
|
||||
}
|
||||
|
||||
func (t *ThresholdSCfg) loadFromJSONCfg(jsnCfg *ThresholdSJsonCfg) (err error) {
|
||||
if jsnCfg == nil {
|
||||
return
|
||||
@@ -93,7 +93,7 @@ func (t *ThresholdSCfg) loadFromJSONCfg(jsnCfg *ThresholdSJsonCfg) (err error) {
|
||||
if jsnCfg.Opts != nil {
|
||||
t.Opts.loadFromJSONCfg(jsnCfg.Opts)
|
||||
}
|
||||
return nil
|
||||
return
|
||||
}
|
||||
|
||||
// AsMapInterface returns the config as a map[string]interface{}
|
||||
|
||||
@@ -47,7 +47,11 @@ func TestThresholdSCfgloadFromJsonCfgCase1(t *testing.T) {
|
||||
NestedFields: true,
|
||||
ActionSConns: []string{utils.ConcatenatedKey(utils.MetaInternal, utils.MetaActions)},
|
||||
Opts: &ThresholdsOpts{
|
||||
ThresholdIDs: []*utils.DynamicStringSliceOpt{},
|
||||
ThresholdIDs: []*utils.DynamicStringSliceOpt{
|
||||
{
|
||||
Value: []string{},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
jsonCfg := NewDefaultCGRConfig()
|
||||
|
||||
Reference in New Issue
Block a user