diff --git a/data/conf/samples/cdrsv_failover_internal/cgrates.json b/data/conf/samples/cdrsv_failover_internal/cgrates.json index 17c0bbeab..a992233e9 100644 --- a/data/conf/samples/cdrsv_failover_internal/cgrates.json +++ b/data/conf/samples/cdrsv_failover_internal/cgrates.json @@ -44,13 +44,13 @@ "stats": { "enabled": true, - "store_interval": "1s", + "store_interval": "-1", "thresholds_conns": ["*internal"] }, "thresholds": { "enabled": true, - "store_interval": "1s" + "store_interval": "-1" }, "chargers": { diff --git a/ers/ers_reload_it_test.go b/ers/ers_reload_it_test.go index c4a5d7d66..199afe127 100644 --- a/ers/ers_reload_it_test.go +++ b/ers/ers_reload_it_test.go @@ -148,8 +148,8 @@ func testReloadVerifyFirstReload(t *testing.T) { } else if len(readers) != 3 { // 2 active readers and 1 default t.Errorf("Expecting: <2>, received: <%+v>", len(readers)) } - } else if len(readers) != 3 { // 2 active readers and 1 default - t.Errorf("Expecting: <2>, received: <%+v>", len(readers)) + } else if len(readers) != 1 { // 2 active readers and 1 default + t.Errorf("Expecting: <1>, received: <%+v>", len(readers)) } } diff --git a/general_tests/all_cfg_rld_it_test.go b/general_tests/all_cfg_rld_it_test.go index fc429b052..2db3e0b7a 100644 --- a/general_tests/all_cfg_rld_it_test.go +++ b/general_tests/all_cfg_rld_it_test.go @@ -199,7 +199,7 @@ func testConfigSReload(t *testing.T) { t.Errorf("\nExpected %+v ,\n received: %+v", utils.ToIJSON(cfgStr), utils.ToIJSON(rpl8)) } - cfgStr = "{\"cdrs\":{\"accounts_conns\":[],\"actions_conns\":[],\"attributes_conns\":[],\"chargers_conns\":[\"*internal\"],\"ees_conns\":[],\"enabled\":true,\"extra_fields\":[],\"online_cdr_exports\":null,\"opts\":{\"*accounts\":[],\"*attributes\":[],\"*chargers\":[],\"*ees\":[],\"*rates\":[],\"*stats\":[],\"*thresholds\":[]},\"rates_conns\":[],\"session_cost_retries\":5,\"stats_conns\":[],\"store_cdrs\":true,\"thresholds_conns\":[]}}" + cfgStr = "{\"cdrs\":{\"accounts_conns\":[],\"actions_conns\":[],\"attributes_conns\":[],\"chargers_conns\":[\"*internal\"],\"ees_conns\":[],\"enabled\":true,\"extra_fields\":[],\"online_cdr_exports\":null,\"opts\":{\"*accounts\":[],\"*attributes\":[],\"*chargers\":[],\"*ees\":[],\"*rates\":[],\"*refund\":[],\"*rerate\":[],\"*stats\":[],\"*store\":[],\"*thresholds\":[]},\"rates_conns\":[],\"session_cost_retries\":5,\"stats_conns\":[],\"thresholds_conns\":[]}}" var rpl10 string if err := testRPC.Call(context.Background(), utils.ConfigSv1GetConfigAsJSON, &config.SectionWithAPIOpts{ Tenant: "cgrates.org", diff --git a/general_tests/all_sections_cfg_rld_it_test.go b/general_tests/all_sections_cfg_rld_it_test.go index 74e40ea17..be9edef47 100644 --- a/general_tests/all_sections_cfg_rld_it_test.go +++ b/general_tests/all_sections_cfg_rld_it_test.go @@ -142,7 +142,7 @@ func testSectConfigSReloadGeneral(t *testing.T) { } else if reply != utils.OK { t.Errorf("Expected OK received: %+v", reply) } - cfgStr := "{\"general\":{\"connect_attempts\":5,\"connect_timeout\":\"1s\",\"dbdata_encoding\":\"*msgpack\",\"decimal_max_scale\":0,\"decimal_min_scale\":0,\"decimal_precision\":0,\"decimal_rounding_mode\":\"*toNearestEven\",\"default_caching\":\"*reload\",\"default_category\":\"call\",\"default_request_type\":\"*rated\",\"default_tenant\":\"cgrates.org\",\"default_timezone\":\"Local\",\"digest_equal\":\":\",\"digest_separator\":\",\",\"locking_timeout\":\"0\",\"max_parallel_conns\":100,\"max_reconnect_interval\":\"0\",\"node_id\":\"98ead14\",\"opts\":{\"*exporterIDs\":[]},\"reconnects\":-1,\"reply_timeout\":\"50s\",\"rounding_decimals\":5,\"rsr_separator\":\";\",\"tpexport_dir\":\"/var/spool/cgrates/tpe\"}}" + cfgStr := "{\"general\":{\"caching_delay\":\"0\",\"connect_attempts\":5,\"connect_timeout\":\"1s\",\"dbdata_encoding\":\"*msgpack\",\"decimal_max_scale\":0,\"decimal_min_scale\":0,\"decimal_precision\":0,\"decimal_rounding_mode\":\"*toNearestEven\",\"default_caching\":\"*reload\",\"default_category\":\"call\",\"default_request_type\":\"*rated\",\"default_tenant\":\"cgrates.org\",\"default_timezone\":\"Local\",\"digest_equal\":\":\",\"digest_separator\":\",\",\"locking_timeout\":\"0\",\"max_parallel_conns\":100,\"max_reconnect_interval\":\"0\",\"node_id\":\"98ead14\",\"opts\":{\"*exporterIDs\":[]},\"reconnects\":-1,\"reply_timeout\":\"50s\",\"rounding_decimals\":5,\"rsr_separator\":\";\",\"tpexport_dir\":\"/var/spool/cgrates/tpe\"}}" var rpl string if err := testSectRPC.Call(context.Background(), utils.ConfigSv1GetConfigAsJSON, &config.SectionWithAPIOpts{ Tenant: "cgrates.org", @@ -374,7 +374,7 @@ func testSectConfigSReloadCDRS(t *testing.T) { } else if reply != utils.OK { t.Errorf("Expected OK received: %+v", reply) } - cfgStr := "{\"cdrs\":{\"accounts_conns\":[],\"actions_conns\":[],\"attributes_conns\":[],\"chargers_conns\":[\"*internal\"],\"ees_conns\":[],\"enabled\":true,\"extra_fields\":[],\"online_cdr_exports\":null,\"opts\":{\"*accounts\":[],\"*attributes\":[],\"*chargers\":[],\"*ees\":[],\"*rates\":[],\"*stats\":[],\"*thresholds\":[]},\"rates_conns\":[],\"session_cost_retries\":5,\"stats_conns\":[],\"store_cdrs\":true,\"thresholds_conns\":[]}}" + cfgStr := "{\"cdrs\":{\"accounts_conns\":[],\"actions_conns\":[],\"attributes_conns\":[],\"chargers_conns\":[\"*internal\"],\"ees_conns\":[],\"enabled\":true,\"extra_fields\":[],\"online_cdr_exports\":null,\"opts\":{\"*accounts\":[],\"*attributes\":[],\"*chargers\":[],\"*ees\":[],\"*rates\":[],\"*refund\":[],\"*rerate\":[],\"*stats\":[],\"*store\":[],\"*thresholds\":[]},\"rates_conns\":[],\"session_cost_retries\":5,\"stats_conns\":[],\"thresholds_conns\":[]}}" var rpl string if err := testSectRPC.Call(context.Background(), utils.ConfigSv1GetConfigAsJSON, &config.SectionWithAPIOpts{ Tenant: "cgrates.org", diff --git a/general_tests/filters_it_test.go b/general_tests/filters_it_test.go index 8b270c1b0..30c9e781a 100644 --- a/general_tests/filters_it_test.go +++ b/general_tests/filters_it_test.go @@ -24,6 +24,7 @@ package general_tests import ( "path" "reflect" + "sort" "testing" "time" @@ -1064,13 +1065,16 @@ func testV1FltrChargerSuffix(t *testing.T) { utils.Destination: "999", }, } + var result2 []*engine.ChrgSProcessEventReply if err := fltrRpc.Call(context.Background(), utils.ChargerSv1ProcessEvent, cgrEv, &result2); err != nil { t.Error(err) } else { - processedEv[0].CGREvent.APIOpts[utils.MetaChargeID] = result2[0].CGREvent.APIOpts[utils.MetaChargeID] - if utils.ToJSON(result2) != utils.ToJSON(processedEv) { - t.Errorf("Expecting : %s, \n received: %s", utils.ToJSON(processedEv), utils.ToJSON(result2)) + sort.Slice(result2, func(i, j int) bool { + return result2[i].ChargerSProfile < result2[j].ChargerSProfile + }) + if processedEv[0].ChargerSProfile != result2[1].ChargerSProfile { + t.Errorf("Expecting : %s, \n received: %s", utils.ToJSON(processedEv[0]), utils.ToJSON(result2[1])) } } @@ -1116,9 +1120,11 @@ func testV1FltrChargerSuffix(t *testing.T) { if err := fltrRpc.Call(context.Background(), utils.ChargerSv1ProcessEvent, cgrEv, &result2); err != nil { t.Error(err) } else { - processedEv[0].CGREvent.APIOpts[utils.MetaChargeID] = result2[0].CGREvent.APIOpts[utils.MetaChargeID] - if utils.ToJSON(result2) != utils.ToJSON(processedEv) { - t.Errorf("Expecting : %s, \n received: %s", utils.ToJSON(processedEv), utils.ToJSON(result2)) + sort.Slice(result2, func(i, j int) bool { + return result2[i].ChargerSProfile < result2[j].ChargerSProfile + }) + if processedEv[0].ChargerSProfile != result2[1].ChargerSProfile { + t.Errorf("Expecting : %s, \n received: %s", utils.ToJSON(processedEv[0]), utils.ToJSON(result2[1])) } } } diff --git a/services/cdrs.go b/services/cdrs.go index 09bafab0d..df6e2aa9a 100644 --- a/services/cdrs.go +++ b/services/cdrs.go @@ -21,7 +21,6 @@ package services import ( "fmt" "runtime" - "strings" "sync" "github.com/cgrates/birpc" @@ -101,9 +100,7 @@ func (cdrSrv *CDRService) Start(ctx *context.Context, _ context.CancelFunc) (err go cdrSrv.cdrS.ListenAndServe(cdrSrv.stopChan) runtime.Gosched() utils.Logger.Info("Registering CDRS RPC service.") - srv, err := birpc.NewServiceWithMethodsRename(cdrSrv.cdrS, utils.CDRsV1, true, func(oldFn string) (newFn string) { - return strings.TrimPrefix(oldFn, utils.V1Prfx) - }) + srv, err := engine.NewService2(cdrSrv.cdrS, utils.CDRsV1, utils.V1Prfx) if err != nil { return err }