mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-17 14:19:54 +05:00
Revise tests after adding opts in GeneralCfg
This commit is contained in:
committed by
Dan Christian Bogos
parent
25b5ad22ac
commit
6c5b69fd35
@@ -46,6 +46,7 @@ func TestConfigV1SetConfigWithDB(t *testing.T) {
|
||||
exp := &GeneralJsonCfg{
|
||||
Node_id: utils.StringPointer("Test"),
|
||||
Default_caching: utils.StringPointer(utils.MetaClear),
|
||||
Opts: &GeneralOptsJson{},
|
||||
}
|
||||
rpl := new(GeneralJsonCfg)
|
||||
if err := db.GetSection(context.Background(), GeneralJSON, rpl); err != nil {
|
||||
@@ -78,6 +79,7 @@ func TestConfigV1StoreCfgInDB(t *testing.T) {
|
||||
exp := &GeneralJsonCfg{
|
||||
Node_id: utils.StringPointer("Test"),
|
||||
Default_caching: utils.StringPointer(utils.MetaClear),
|
||||
Opts: &GeneralOptsJson{},
|
||||
}
|
||||
rpl := new(GeneralJsonCfg)
|
||||
if err := db.GetSection(context.Background(), GeneralJSON, rpl); err != nil {
|
||||
@@ -159,6 +161,7 @@ func TestConfigV1SetConfigFromJSONWithDB(t *testing.T) {
|
||||
exp := &GeneralJsonCfg{
|
||||
Node_id: utils.StringPointer("Test"),
|
||||
Default_caching: utils.StringPointer(utils.MetaClear),
|
||||
Opts: &GeneralOptsJson{},
|
||||
}
|
||||
rpl := new(GeneralJsonCfg)
|
||||
if err := db.GetSection(context.Background(), GeneralJSON, rpl); err != nil {
|
||||
@@ -235,6 +238,9 @@ func TestConfigLoadFromDB(t *testing.T) {
|
||||
MaxParallelConns: 100,
|
||||
RSRSep: ";",
|
||||
FailedPostsTTL: 5 * time.Second,
|
||||
Opts: &GeneralOpts{
|
||||
ExporterIDs: []*utils.DynamicStringSliceOpt{},
|
||||
},
|
||||
}
|
||||
if !reflect.DeepEqual(expGeneral, cfg.GeneralCfg()) {
|
||||
t.Errorf("Expected: %s ,received: %s", utils.ToJSON(expGeneral), utils.ToJSON(cfg.GeneralCfg()))
|
||||
@@ -249,6 +255,7 @@ func TestConfigLoadFromDB(t *testing.T) {
|
||||
exp := &GeneralJsonCfg{
|
||||
Node_id: utils.StringPointer("Test2"),
|
||||
Default_caching: utils.StringPointer(utils.MetaClear),
|
||||
Opts: &GeneralOptsJson{},
|
||||
}
|
||||
rpl := new(GeneralJsonCfg)
|
||||
if err := db.GetSection(context.Background(), GeneralJSON, rpl); err != nil {
|
||||
|
||||
@@ -58,6 +58,9 @@ func TestDfGeneralJsonCfg(t *testing.T) {
|
||||
Decimal_min_scale: utils.IntPointer(0),
|
||||
Decimal_precision: utils.IntPointer(0),
|
||||
Decimal_rounding_mode: utils.StringPointer("*toNearestEven"),
|
||||
Opts: &GeneralOptsJson{
|
||||
ExporterIDs: []*utils.DynamicStringSliceOpt{},
|
||||
},
|
||||
}
|
||||
dfCgrJSONCfg, err := NewCgrJsonCfgFromBytes([]byte(CGRATES_CFG_JSON))
|
||||
if err != nil {
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -44,6 +44,7 @@ func TestGeneralCfgloadFromJsonCfg(t *testing.T) {
|
||||
Digest_separator: utils.StringPointer(","),
|
||||
Digest_equal: utils.StringPointer(":"),
|
||||
Failed_posts_ttl: utils.StringPointer("2"),
|
||||
Opts: &GeneralOptsJson{},
|
||||
}
|
||||
|
||||
expected := &GeneralCfg{
|
||||
@@ -69,6 +70,9 @@ func TestGeneralCfgloadFromJsonCfg(t *testing.T) {
|
||||
RSRSep: ";",
|
||||
DefaultCaching: utils.MetaReload,
|
||||
FailedPostsTTL: 2,
|
||||
Opts: &GeneralOpts{
|
||||
ExporterIDs: []*utils.DynamicStringSliceOpt{},
|
||||
},
|
||||
}
|
||||
jsnCfg := NewDefaultCGRConfig()
|
||||
if err = jsnCfg.generalCfg.loadFromJSONCfg(cfgJSON); err != nil {
|
||||
@@ -174,6 +178,9 @@ func TestGeneralCfgAsMapInterface(t *testing.T) {
|
||||
utils.DecimalMinScaleCfg: 0,
|
||||
utils.DecimalPrecisionCfg: 0,
|
||||
utils.DecimalRoundingModeCfg: "*toNearestEven",
|
||||
utils.OptsCfg: map[string]interface{}{
|
||||
utils.MetaExporterIDs: []*utils.DynamicStringSliceOpt{},
|
||||
},
|
||||
}
|
||||
if cgrCfg, err := NewCGRConfigFromJSONStringWithDefaults(cfgJSONStr); err != nil {
|
||||
t.Error(err)
|
||||
@@ -221,6 +228,9 @@ func TestGeneralCfgAsMapInterface1(t *testing.T) {
|
||||
utils.DecimalMinScaleCfg: 0,
|
||||
utils.DecimalPrecisionCfg: 0,
|
||||
utils.DecimalRoundingModeCfg: "*toNearestEven",
|
||||
utils.OptsCfg: map[string]interface{}{
|
||||
utils.MetaExporterIDs: []*utils.DynamicStringSliceOpt{},
|
||||
},
|
||||
}
|
||||
if cgrCfg, err := NewCGRConfigFromJSONStringWithDefaults(cfgJSONStr); err != nil {
|
||||
t.Error(err)
|
||||
@@ -253,6 +263,13 @@ func TestGeneralCfgClone(t *testing.T) {
|
||||
RSRSep: ";",
|
||||
DefaultCaching: utils.MetaReload,
|
||||
FailedPostsTTL: 2,
|
||||
Opts: &GeneralOpts{
|
||||
ExporterIDs: []*utils.DynamicStringSliceOpt{
|
||||
{
|
||||
Value: []string{"*ees"},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
rcv := ban.Clone()
|
||||
if !reflect.DeepEqual(ban, rcv) {
|
||||
@@ -289,6 +306,13 @@ func TestDiffGeneralJsonCfg(t *testing.T) {
|
||||
RSRSep: "",
|
||||
DefaultCaching: utils.MetaClear,
|
||||
FailedPostsTTL: 5,
|
||||
Opts: &GeneralOpts{
|
||||
ExporterIDs: []*utils.DynamicStringSliceOpt{
|
||||
{
|
||||
Value: []string{"*ees"},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
v2 := &GeneralCfg{
|
||||
@@ -315,6 +339,13 @@ func TestDiffGeneralJsonCfg(t *testing.T) {
|
||||
DefaultCaching: utils.MetaReload,
|
||||
LockingTimeout: 2 * time.Second,
|
||||
FailedPostsTTL: 2,
|
||||
Opts: &GeneralOpts{
|
||||
ExporterIDs: []*utils.DynamicStringSliceOpt{
|
||||
{
|
||||
Value: []string{"*syslog"},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
expected := &GeneralJsonCfg{
|
||||
@@ -341,6 +372,13 @@ func TestDiffGeneralJsonCfg(t *testing.T) {
|
||||
Digest_equal: utils.StringPointer(":"),
|
||||
Failed_posts_ttl: utils.StringPointer("2ns"),
|
||||
Max_parallel_conns: utils.IntPointer(100),
|
||||
Opts: &GeneralOptsJson{
|
||||
ExporterIDs: []*utils.DynamicStringSliceOpt{
|
||||
{
|
||||
Value: []string{"*syslog"},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
rcv := diffGeneralJsonCfg(d, v1, v2)
|
||||
@@ -349,7 +387,9 @@ func TestDiffGeneralJsonCfg(t *testing.T) {
|
||||
}
|
||||
|
||||
v1 = v2
|
||||
expected = &GeneralJsonCfg{}
|
||||
expected = &GeneralJsonCfg{
|
||||
Opts: &GeneralOptsJson{},
|
||||
}
|
||||
|
||||
rcv = diffGeneralJsonCfg(d, v1, v2)
|
||||
if !reflect.DeepEqual(rcv, expected) {
|
||||
@@ -381,6 +421,7 @@ func TestGeneralCfgCloneSection(t *testing.T) {
|
||||
RSRSep: "",
|
||||
DefaultCaching: utils.MetaClear,
|
||||
FailedPostsTTL: 5,
|
||||
Opts: &GeneralOpts{},
|
||||
}
|
||||
|
||||
exp := &GeneralCfg{
|
||||
@@ -406,6 +447,7 @@ func TestGeneralCfgCloneSection(t *testing.T) {
|
||||
RSRSep: "",
|
||||
DefaultCaching: utils.MetaClear,
|
||||
FailedPostsTTL: 5,
|
||||
Opts: &GeneralOpts{},
|
||||
}
|
||||
|
||||
rcv := gnrCfg.CloneSection()
|
||||
|
||||
@@ -78,6 +78,9 @@ func TestMfEnvReaderITRead(t *testing.T) {
|
||||
RSRSep: ";",
|
||||
MaxParallelConns: 100,
|
||||
FailedPostsTTL: 5 * time.Second,
|
||||
Opts: &GeneralOpts{
|
||||
ExporterIDs: []*utils.DynamicStringSliceOpt{},
|
||||
},
|
||||
}
|
||||
if !reflect.DeepEqual(expected, *mfCgrCfg.generalCfg) {
|
||||
t.Errorf("Expected: %+v\n, received: %+v", utils.ToJSON(expected), utils.ToJSON(*mfCgrCfg.generalCfg))
|
||||
|
||||
Reference in New Issue
Block a user