From b1fdfea00970b7a86b532c6e9d07e2a0c2f577c4 Mon Sep 17 00:00:00 2001 From: Trial97 Date: Thu, 12 Dec 2019 08:29:05 +0200 Subject: [PATCH] Updated config_default --- config/config_defaults.go | 14 ++++++------- config/config_json_test.go | 21 +++++++------------ data/conf/cgrates/cgrates.json | 14 ++++++------- engine/cdr_test.go | 38 +++++++++++++++++----------------- engine/eventcost.go | 6 +++--- 5 files changed, 43 insertions(+), 50 deletions(-) diff --git a/config/config_defaults.go b/config/config_defaults.go index daeea6cd1..5c8283b47 100755 --- a/config/config_defaults.go +++ b/config/config_defaults.go @@ -165,7 +165,7 @@ const CGRATES_CFG_JSON = ` "*timings": {"limit": -1, "ttl": "", "static_ttl": false, "precache": false}, // timings caching "*resource_profiles": {"limit": -1, "ttl": "", "static_ttl": false, "precache": false}, // control resource profiles caching "*resources": {"limit": -1, "ttl": "", "static_ttl": false, "precache": false}, // control resources caching - "*event_resources": {"limit": -1, "ttl": "", "static_ttl": false, "precache": false}, // matching resources to events + "*event_resources": {"limit": -1, "ttl": "", "static_ttl": false}, // matching resources to events "*statqueue_profiles": {"limit": -1, "ttl": "", "static_ttl": false, "precache": false}, // statqueue profiles "*statqueues": {"limit": -1, "ttl": "", "static_ttl": false, "precache": false}, // statqueues with metrics "*threshold_profiles": {"limit": -1, "ttl": "", "static_ttl": false, "precache": false}, // control threshold profiles caching @@ -183,13 +183,13 @@ const CGRATES_CFG_JSON = ` "*attribute_filter_indexes" : {"limit": -1, "ttl": "", "static_ttl": false}, // control attribute filter indexes caching "*charger_filter_indexes" : {"limit": -1, "ttl": "", "static_ttl": false}, // control charger filter indexes caching "*dispatcher_filter_indexes" : {"limit": -1, "ttl": "", "static_ttl": false}, // control dispatcher filter indexes caching - "*dispatcher_routes": {"limit": -1, "ttl": "", "static_ttl": false, "precache": false}, // control dispatcher routes caching - "*diameter_messages": {"limit": -1, "ttl": "3h", "static_ttl": false, "precache": false}, // diameter messages caching - "*rpc_responses": {"limit": 0, "ttl": "2s", "static_ttl": false, "precache": false}, // RPC responses caching - "*closed_sessions": {"limit": -1, "ttl": "10s", "static_ttl": false, "precache": false}, // closed sessions cached for CDRs - "*cdr_ids": {"limit": -1, "ttl": "", "static_ttl": false, "precache": false}, // protects CDRs against double-charging + "*dispatcher_routes": {"limit": -1, "ttl": "", "static_ttl": false}, // control dispatcher routes caching + "*diameter_messages": {"limit": -1, "ttl": "3h", "static_ttl": false}, // diameter messages caching + "*rpc_responses": {"limit": 0, "ttl": "2s", "static_ttl": false}, // RPC responses caching + "*closed_sessions": {"limit": -1, "ttl": "10s", "static_ttl": false}, // closed sessions cached for CDRs + "*cdr_ids": {"limit": -1, "ttl": "", "static_ttl": false}, // protects CDRs against double-charging "*load_ids": {"limit": -1, "ttl": "", "static_ttl": false, "precache": false}, // control the load_ids for items - "*rpc_connections": {"limit": -1, "ttl": "", "static_ttl": false, "precache": false}, // RPC connections caching + "*rpc_connections": {"limit": -1, "ttl": "", "static_ttl": false}, // RPC connections caching }, diff --git a/config/config_json_test.go b/config/config_json_test.go index 49eccab9a..d2d4b01e8 100755 --- a/config/config_json_test.go +++ b/config/config_json_test.go @@ -106,8 +106,7 @@ func TestCacheJsonCfg(t *testing.T) { Ttl: utils.StringPointer(""), Static_ttl: utils.BoolPointer(false), Precache: utils.BoolPointer(false)}, utils.CacheEventResources: &CacheParamJsonCfg{Limit: utils.IntPointer(-1), - Ttl: utils.StringPointer(""), Static_ttl: utils.BoolPointer(false), - Precache: utils.BoolPointer(false)}, + Ttl: utils.StringPointer(""), Static_ttl: utils.BoolPointer(false)}, utils.CacheStatQueueProfiles: &CacheParamJsonCfg{Limit: utils.IntPointer(-1), Ttl: utils.StringPointer(""), Static_ttl: utils.BoolPointer(false), Precache: utils.BoolPointer(false)}, @@ -153,26 +152,20 @@ func TestCacheJsonCfg(t *testing.T) { utils.CacheDispatcherFilterIndexes: &CacheParamJsonCfg{Limit: utils.IntPointer(-1), Ttl: utils.StringPointer(""), Static_ttl: utils.BoolPointer(false)}, utils.CacheDispatcherRoutes: &CacheParamJsonCfg{Limit: utils.IntPointer(-1), - Ttl: utils.StringPointer(""), Static_ttl: utils.BoolPointer(false), - Precache: utils.BoolPointer(false)}, + Ttl: utils.StringPointer(""), Static_ttl: utils.BoolPointer(false)}, utils.CacheDiameterMessages: &CacheParamJsonCfg{Limit: utils.IntPointer(-1), - Ttl: utils.StringPointer("3h"), Static_ttl: utils.BoolPointer(false), - Precache: utils.BoolPointer(false)}, + Ttl: utils.StringPointer("3h"), Static_ttl: utils.BoolPointer(false)}, utils.CacheRPCResponses: &CacheParamJsonCfg{Limit: utils.IntPointer(0), - Ttl: utils.StringPointer("2s"), Static_ttl: utils.BoolPointer(false), - Precache: utils.BoolPointer(false)}, + Ttl: utils.StringPointer("2s"), Static_ttl: utils.BoolPointer(false)}, utils.CacheClosedSessions: &CacheParamJsonCfg{Limit: utils.IntPointer(-1), - Ttl: utils.StringPointer("10s"), Static_ttl: utils.BoolPointer(false), - Precache: utils.BoolPointer(false)}, + Ttl: utils.StringPointer("10s"), Static_ttl: utils.BoolPointer(false)}, utils.CacheCDRIDs: &CacheParamJsonCfg{Limit: utils.IntPointer(-1), - Ttl: utils.StringPointer(""), Static_ttl: utils.BoolPointer(false), - Precache: utils.BoolPointer(false)}, + Ttl: utils.StringPointer(""), Static_ttl: utils.BoolPointer(false)}, utils.CacheLoadIDs: &CacheParamJsonCfg{Limit: utils.IntPointer(-1), Ttl: utils.StringPointer(""), Static_ttl: utils.BoolPointer(false), Precache: utils.BoolPointer(false)}, utils.CacheRPCConnections: &CacheParamJsonCfg{Limit: utils.IntPointer(-1), - Ttl: utils.StringPointer(""), Static_ttl: utils.BoolPointer(false), - Precache: utils.BoolPointer(false)}, + Ttl: utils.StringPointer(""), Static_ttl: utils.BoolPointer(false)}, } if gCfg, err := dfCgrJsonCfg.CacheJsonCfg(); err != nil { diff --git a/data/conf/cgrates/cgrates.json b/data/conf/cgrates/cgrates.json index 6b7c123bd..554313eaa 100644 --- a/data/conf/cgrates/cgrates.json +++ b/data/conf/cgrates/cgrates.json @@ -144,7 +144,7 @@ // "*timings": {"limit": -1, "ttl": "", "static_ttl": false, "precache": false}, // timings caching // "*resource_profiles": {"limit": -1, "ttl": "", "static_ttl": false, "precache": false}, // control resource profiles caching // "*resources": {"limit": -1, "ttl": "", "static_ttl": false, "precache": false}, // control resources caching -// "*event_resources": {"limit": -1, "ttl": "", "static_ttl": false, "precache": false}, // matching resources to events +// "*event_resources": {"limit": -1, "ttl": "", "static_ttl": false}, // matching resources to events // "*statqueue_profiles": {"limit": -1, "ttl": "", "static_ttl": false, "precache": false}, // statqueue profiles // "*statqueues": {"limit": -1, "ttl": "", "static_ttl": false, "precache": false}, // statqueues with metrics // "*threshold_profiles": {"limit": -1, "ttl": "", "static_ttl": false, "precache": false}, // control threshold profiles caching @@ -162,13 +162,13 @@ // "*attribute_filter_indexes" : {"limit": -1, "ttl": "", "static_ttl": false}, // control attribute filter indexes caching // "*charger_filter_indexes" : {"limit": -1, "ttl": "", "static_ttl": false}, // control charger filter indexes caching // "*dispatcher_filter_indexes" : {"limit": -1, "ttl": "", "static_ttl": false}, // control dispatcher filter indexes caching -// "*dispatcher_routes": {"limit": -1, "ttl": "", "static_ttl": false, "precache": false}, // control dispatcher routes caching -// "*diameter_messages": {"limit": -1, "ttl": "3h", "static_ttl": false, "precache": false}, // diameter messages caching -// "*rpc_responses": {"limit": 0, "ttl": "2s", "static_ttl": false, "precache": false}, // RPC responses caching -// "*closed_sessions": {"limit": -1, "ttl": "10s", "static_ttl": false, "precache": false}, // closed sessions cached for CDRs -// "*cdr_ids": {"limit": -1, "ttl": "", "static_ttl": false, "precache": false}, // protects CDRs against double-charging +// "*dispatcher_routes": {"limit": -1, "ttl": "", "static_ttl": false}, // control dispatcher routes caching +// "*diameter_messages": {"limit": -1, "ttl": "3h", "static_ttl": false}, // diameter messages caching +// "*rpc_responses": {"limit": 0, "ttl": "2s", "static_ttl": false}, // RPC responses caching +// "*closed_sessions": {"limit": -1, "ttl": "10s", "static_ttl": false}, // closed sessions cached for CDRs +// "*cdr_ids": {"limit": -1, "ttl": "", "static_ttl": false}, // protects CDRs against double-charging // "*load_ids": {"limit": -1, "ttl": "", "static_ttl": false, "precache": false}, // control the load_ids for items -// "*rpc_connections": {"limit": -1, "ttl": "", "static_ttl": false, "precache": false}, // RPC connections caching +// "*rpc_connections": {"limit": -1, "ttl": "", "static_ttl": false}, // RPC connections caching // }, diff --git a/engine/cdr_test.go b/engine/cdr_test.go index 950bf4a21..9fa807184 100644 --- a/engine/cdr_test.go +++ b/engine/cdr_test.go @@ -473,46 +473,46 @@ func TestCDRParseFieldValue(t *testing.T) { } } -func TestCdrClone(t * testing.T){ +func TestCdrClone(t *testing.T) { cdr := &CDR{} eOut := &CDR{} - if rcv := cdr.Clone(); !reflect.DeepEqual(rcv,eOut) { - t.Errorf("Expecting: %+v, received: %+v",eOut,rcv) + if rcv := cdr.Clone(); !reflect.DeepEqual(rcv, eOut) { + t.Errorf("Expecting: %+v, received: %+v", eOut, rcv) } cdr = &CDR{ - CGRID: "CGRID_test", - OrderID: 18, + CGRID: "CGRID_test", + OrderID: 18, SetupTime: time.Date(2020, time.April, 18, 23, 0, 4, 0, time.UTC), - Usage: time.Duration(10), + Usage: time.Duration(10), ExtraFields: map[string]string{ - "test1":"_test1_", - "test2":"_test2_", + "test1": "_test1_", + "test2": "_test2_", }, Partial: true, - Cost: 0.74, + Cost: 0.74, CostDetails: &EventCost{ CGRID: "EventCost_CGRID", - Cost: utils.Float64Pointer(0.74), + Cost: utils.Float64Pointer(0.74), }, } eOut = &CDR{ - CGRID: "CGRID_test", - OrderID: 18, + CGRID: "CGRID_test", + OrderID: 18, SetupTime: time.Date(2020, time.April, 18, 23, 0, 4, 0, time.UTC), - Usage: time.Duration(10), + Usage: time.Duration(10), ExtraFields: map[string]string{ - "test1":"_test1_", - "test2":"_test2_", + "test1": "_test1_", + "test2": "_test2_", }, Partial: true, - Cost: 0.74, + Cost: 0.74, CostDetails: &EventCost{ CGRID: "EventCost_CGRID", - Cost: utils.Float64Pointer(0.74), + Cost: utils.Float64Pointer(0.74), }, } - if rcv := cdr.Clone(); !reflect.DeepEqual(rcv,eOut) { - t.Errorf("Expecting: %+v,\n received: %+v",eOut,rcv) + if rcv := cdr.Clone(); !reflect.DeepEqual(rcv, eOut) { + t.Errorf("Expecting: %+v,\n received: %+v", eOut, rcv) } } diff --git a/engine/eventcost.go b/engine/eventcost.go index 609f94bc5..ebbd35bbb 100644 --- a/engine/eventcost.go +++ b/engine/eventcost.go @@ -192,13 +192,13 @@ func (ec *EventCost) Clone() (cln *EventCost) { if ec.AccountSummary != nil { cln.AccountSummary = ec.AccountSummary.Clone() } - if ec.Rating != nil { + if ec.Rating != nil { cln.Rating = ec.Rating.Clone() } - if ec.Accounting != nil { + if ec.Accounting != nil { cln.Accounting = ec.Accounting.Clone() } - if ec.RatingFilters != nil { + if ec.RatingFilters != nil { cln.RatingFilters = ec.RatingFilters.Clone() } if ec.Rates != nil {