diff --git a/config/efscfg_test.go b/config/efscfg_test.go
new file mode 100644
index 000000000..0f503f7f6
--- /dev/null
+++ b/config/efscfg_test.go
@@ -0,0 +1,142 @@
+/*
+Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
+Copyright (C) ITsysCOM GmbH
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see
+*/
+package config
+
+import (
+ "reflect"
+ "testing"
+
+ "github.com/cgrates/birpc/context"
+ "github.com/cgrates/cgrates/utils"
+)
+
+type mockConfDb struct {
+ GetSectionF func(*context.Context, string, interface{}) error
+ SetSectionF func(*context.Context, string, interface{}) error
+}
+
+func (m *mockConfDb) GetSection(ctx *context.Context, sec string, val interface{}) error {
+ if m.GetSectionF != nil {
+ return m.GetSectionF(ctx, sec, val)
+ }
+ return utils.ErrNotImplemented
+}
+
+func (m *mockConfDb) SetSection(ctx *context.Context, sec string, val interface{}) error {
+ if m.SetSectionF != nil {
+ return m.SetSectionF(ctx, sec, val)
+ }
+ return utils.ErrNotImplemented
+}
+func TestEFsCfgLoad(t *testing.T) {
+ m := &mockConfDb{}
+ efsCfg := &EFsCfg{}
+ if err := efsCfg.Load(context.Background(), m, cfg); err != utils.ErrNotImplemented {
+ t.Errorf("Expected error <%v>, Received errpr <%v>", utils.ErrNotImplemented, err)
+ }
+}
+
+func TestEFsCfgLoadFromJSONCfg(t *testing.T) {
+ efsCfg := &EFsCfg{}
+ var jsonEFsCfg *EfsJsonCfg
+ efsCfgClone := efsCfg.Clone()
+ if err := efsCfg.loadFromJSONCfg(jsonEFsCfg); err != nil {
+ t.Errorf("Expected error , Received error <%v>", err)
+ } else if !reflect.DeepEqual(efsCfg, efsCfgClone) {
+ t.Errorf("Expected EFsCfg to not change, was <%v>\nNow is <%v>",
+ utils.ToJSON(efsCfgClone), utils.ToJSON(efsCfg))
+ }
+}
+func TestEFsCfgLoadFromJSONCfgFailedPostsTTL(t *testing.T) {
+ efsCfg := &EFsCfg{}
+ jsonEFsCfg := &EfsJsonCfg{
+ Failed_posts_ttl: utils.StringPointer("failedPost"),
+ }
+ expErr := `time: invalid duration "failedPost"`
+ if err := efsCfg.loadFromJSONCfg(jsonEFsCfg); err.Error() != expErr {
+ t.Errorf("Expected error <%v>, Received error <%v>", expErr, err)
+ }
+}
+
+func TestEFsCfgCloneSection(t *testing.T) {
+ efsCfg := EFsCfg{
+ Enabled: true,
+ }
+ if !reflect.DeepEqual(efsCfg.CloneSection(), efsCfg.Clone()) {
+ t.Errorf("Expected EFsCfg.CloneSection result <%v>, Received result <%v>", efsCfg.Clone(), efsCfg.CloneSection())
+ }
+
+}
+func TestDiffEFsJsonCfgEfsJsonCfgNil(t *testing.T) {
+ var d *EfsJsonCfg
+
+ v1 := &EFsCfg{}
+
+ v2 := &EFsCfg{}
+
+ expected := &EfsJsonCfg{}
+
+ rcv := diffEFsJsonCfg(d, v1, v2)
+ if !reflect.DeepEqual(rcv, expected) {
+ t.Errorf("Expected %v \n but received \n %v", utils.ToJSON(expected), utils.ToJSON(rcv))
+ }
+
+}
+
+func TestDiffEFsJsonCfg(t *testing.T) {
+ d := &EfsJsonCfg{}
+
+ v1 := &EFsCfg{
+ Enabled: false,
+ PosterAttempts: 2,
+ FailedPostsDir: "2",
+ FailedPostsTTL: 2,
+ }
+
+ v2 := &EFsCfg{
+ Enabled: true,
+ PosterAttempts: 3,
+ FailedPostsDir: "3",
+ FailedPostsTTL: 3,
+ }
+
+ expected := &EfsJsonCfg{
+ Enabled: utils.BoolPointer(true),
+ Poster_attempts: utils.IntPointer(3),
+ Failed_posts_dir: utils.StringPointer("3"),
+ Failed_posts_ttl: utils.StringPointer("3ns"),
+ }
+
+ rcv := diffEFsJsonCfg(d, v1, v2)
+ if !reflect.DeepEqual(rcv, expected) {
+ t.Errorf("Expected %v \n but received \n %v", utils.ToJSON(expected), utils.ToJSON(rcv))
+ }
+
+ v2_2 := v1
+ expected2 := &EfsJsonCfg{
+ Enabled: utils.BoolPointer(true),
+ Poster_attempts: utils.IntPointer(3),
+ Failed_posts_dir: utils.StringPointer("3"),
+ Failed_posts_ttl: utils.StringPointer("3ns"),
+ }
+
+ rcv = diffEFsJsonCfg(d, v1, v2_2)
+ if !reflect.DeepEqual(rcv, expected2) {
+ t.Errorf("Expected %v \n but received \n %v", utils.ToJSON(expected2), utils.ToJSON(rcv))
+ }
+}
diff --git a/config/erscfg.go b/config/erscfg.go
index 87812acda..6f4a3ac09 100644
--- a/config/erscfg.go
+++ b/config/erscfg.go
@@ -584,8 +584,8 @@ func (erOpts *EventReaderOpts) Clone() *EventReaderOpts {
if erOpts.KafkaCAPathProcessed != nil {
cln.KafkaCAPathProcessed = utils.StringPointer(*erOpts.KafkaCAPathProcessed)
}
- if erOpts.KafkaSkipTLSVerify != nil {
- cln.KafkaSkipTLSVerify = utils.BoolPointer(*erOpts.KafkaSkipTLSVerify)
+ if erOpts.KafkaSkipTLSVerifyProcessed != nil {
+ cln.KafkaSkipTLSVerifyProcessed = utils.BoolPointer(*erOpts.KafkaSkipTLSVerifyProcessed)
}
if erOpts.SQLDBName != nil {
cln.SQLDBName = utils.StringPointer(*erOpts.SQLDBName)