From 20c6a48e5be51cf4d9951605a0c078bf9725a52f Mon Sep 17 00:00:00 2001 From: andronache Date: Thu, 19 Aug 2021 12:54:19 +0300 Subject: [PATCH] Added thresholds properly to reload test --- .../samples/reload_sect_mysql/cgrates.json | 6 +++--- general_tests/all_cfg_sect_rld_it_test.go | 19 +++++++++++++------ 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/data/conf/samples/reload_sect_mysql/cgrates.json b/data/conf/samples/reload_sect_mysql/cgrates.json index 2ab7c52e5..a5fc7c637 100644 --- a/data/conf/samples/reload_sect_mysql/cgrates.json +++ b/data/conf/samples/reload_sect_mysql/cgrates.json @@ -599,10 +599,10 @@ }, "thresholds": { - "enabled": true, + "enabled": false, "store_interval": "", - "indexed_selects": true, - //"string_indexed_fields": [], + "indexed_selects": false, + "string_indexed_fields": [], "prefix_indexed_fields": [], "suffix_indexed_fields": [], "nested_fields": false, diff --git a/general_tests/all_cfg_sect_rld_it_test.go b/general_tests/all_cfg_sect_rld_it_test.go index 6d0d1fe84..0cde8c62c 100644 --- a/general_tests/all_cfg_sect_rld_it_test.go +++ b/general_tests/all_cfg_sect_rld_it_test.go @@ -48,6 +48,7 @@ var ( //testSectConfigSReloadDataDB, //testSectConfigSReloadStorDB, testSectConfigSReloadListen, + testSectConfigSReloadThresholds, testSectConfigSReloadRALS, testSectConfigSReloadAttributes, @@ -78,7 +79,7 @@ var ( testSectConfigSReloadChargers, testSectConfigSReloadResources, testSectConfigSReloadStats, - testSectConfigSReloadThresholds, + testSectConfigSReloadLoaders, testSectConfigSReloadMailer, @@ -858,21 +859,27 @@ func testSectConfigSReloadStats(t *testing.T) { func testSectConfigSReloadThresholds(t *testing.T) { var replyPingBf string - if err := testSectRPC.Call(utils.ThresholdSv1Ping, &utils.CGREvent{}, &replyPingBf); err != nil { + if err := testSectRPC.Call(utils.ThresholdSv1Ping, &utils.CGREvent{}, &replyPingBf); err == nil || err.Error() != "rpc: can't find service ThresholdSv1.Ping" { t.Error(err) - } else if replyPingBf != utils.Pong { - t.Errorf("Expected OK received: %s", replyPingBf) } var reply string if err := testSectRPC.Call(utils.ConfigSv1SetConfigFromJSON, &config.SetConfigFromJSONArgs{ Tenant: "cgrates.org", - Config: "{\"thresholds\":{\"enabled\":true,\"indexed_selects\":true,\"nested_fields\":false,\"prefix_indexed_fields\":[],\"store_interval\":\"-1ns\",\"suffix_indexed_fields\":[]}}", + Config: `{"thresholds": { + "enabled": true, + "store_interval": "0ns", + "indexed_selects": true, + "string_indexed_fields": ["string_indexed_fields"], + "prefix_indexed_fields": ["prefix_indexed_fields"], + "suffix_indexed_fields": ["suffix_indexed_fields"], + "nested_fields": true, + },}}`, }, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Errorf("Expected OK received: %+v", reply) } - cfgStr := "{\"thresholds\":{\"enabled\":true,\"indexed_selects\":true,\"nested_fields\":false,\"prefix_indexed_fields\":[],\"store_interval\":\"-1ns\",\"suffix_indexed_fields\":[]}}" + cfgStr := "{\"thresholds\":{\"enabled\":true,\"indexed_selects\":true,\"nested_fields\":true,\"prefix_indexed_fields\":[\"prefix_indexed_fields\"],\"store_interval\":\"\",\"string_indexed_fields\":[\"string_indexed_fields\"],\"suffix_indexed_fields\":[\"suffix_indexed_fields\"]}}" var rpl string if err := testSectRPC.Call(utils.ConfigSv1GetConfigAsJSON, &config.SectionWithAPIOpts{ Tenant: "cgrates.org",