From e8a0d39473c5df8199c951cd141c246062b02abb Mon Sep 17 00:00:00 2001 From: andronache Date: Fri, 30 Jul 2021 18:26:28 +0300 Subject: [PATCH] Added pings in integration test --- general_tests/all_cfg_sect_rld_it_test.go | 151 ++++++++++++++++++++++ 1 file changed, 151 insertions(+) diff --git a/general_tests/all_cfg_sect_rld_it_test.go b/general_tests/all_cfg_sect_rld_it_test.go index c4140b5e0..9444be9ef 100644 --- a/general_tests/all_cfg_sect_rld_it_test.go +++ b/general_tests/all_cfg_sect_rld_it_test.go @@ -139,6 +139,12 @@ func testSectRPCConn(t *testing.T) { func testSectConfigSReloadCores(t *testing.T) { + var replyPingBf string + if err := testSectRPC.Call(utils.CoreSv1Ping, &utils.CGREvent{}, &replyPingBf); err != nil { + 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", @@ -158,6 +164,13 @@ func testSectConfigSReloadCores(t *testing.T) { } else if cfgStr != rpl { t.Errorf("\nExpected %+v ,\n received: %+v", utils.ToIJSON(cfgStr), utils.ToIJSON(rpl)) } + + var replyPingAf string + if err := testSectRPC.Call(utils.CoreSv1Ping, &utils.CGREvent{}, &replyPingAf); err != nil { + t.Error(err) + } else if replyPingAf != utils.Pong { + t.Errorf("Expected OK received: %s", replyPingAf) + } } func testSectConfigSReloadRPCConns(t *testing.T) { @@ -300,6 +313,12 @@ func testSectConfigSReloadHTTP(t *testing.T) { } func testSectConfigSReloadSchedulers(t *testing.T) { + var replyPingBf string + if err := testSectRPC.Call(utils.SchedulerSv1Ping, &utils.CGREvent{}, &replyPingBf); err != nil { + 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{ @@ -320,10 +339,24 @@ func testSectConfigSReloadSchedulers(t *testing.T) { } else if cfgStr != rpl { t.Errorf("\nExpected %+v ,\n received: %+v", utils.ToIJSON(cfgStr), utils.ToIJSON(rpl)) } + + var replyPingAf string + if err := testSectRPC.Call(utils.SchedulerSv1Ping, &utils.CGREvent{}, &replyPingAf); err != nil { + t.Error(err) + } else if replyPingAf != utils.Pong { + t.Errorf("Expected OK received: %s", replyPingAf) + } } func testSectConfigSReloadCaches(t *testing.T) { + var replyPingBf string + if err := testSectRPC.Call(utils.CacheSv1Ping, &utils.CGREvent{}, &replyPingBf); err != nil { + 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", @@ -343,6 +376,13 @@ func testSectConfigSReloadCaches(t *testing.T) { } else if cfgStr != rpl { t.Errorf("\nExpected %+v ,\n received: %+v", utils.ToIJSON(cfgStr), utils.ToIJSON(rpl)) } + + var replyPingAf string + if err := testSectRPC.Call(utils.CacheSv1Ping, &utils.CGREvent{}, &replyPingAf); err != nil { + t.Error(err) + } else if replyPingAf != utils.Pong { + t.Errorf("Expected OK received: %s", replyPingAf) + } } func testSectConfigSReloadFilters(t *testing.T) { @@ -370,6 +410,13 @@ func testSectConfigSReloadFilters(t *testing.T) { func testSectConfigSReloadRALS(t *testing.T) { + var replyPingBf string + if err := testSectRPC.Call(utils.RALsV1Ping, &utils.CGREvent{}, &replyPingBf); err != nil { + 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", @@ -389,10 +436,24 @@ func testSectConfigSReloadRALS(t *testing.T) { } else if cfgStr != rpl { t.Errorf("\nExpected %+v ,\n received: %+v", utils.ToIJSON(cfgStr), utils.ToIJSON(rpl)) } + + var replyPingAf string + if err := testSectRPC.Call(utils.RALsV1Ping, &utils.CGREvent{}, &replyPingAf); err != nil { + t.Error(err) + } else if replyPingAf != utils.Pong { + t.Errorf("Expected OK received: %s", replyPingAf) + } } func testSectConfigSReloadCDRS(t *testing.T) { + var replyPingBf string + if err := testSectRPC.Call(utils.CDRsV1Ping, &utils.CGREvent{}, &replyPingBf); err != nil { + 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", @@ -412,6 +473,13 @@ func testSectConfigSReloadCDRS(t *testing.T) { } else if cfgStr != rpl { t.Errorf("\nExpected %+v ,\n received: %+v", utils.ToIJSON(cfgStr), utils.ToIJSON(rpl)) } + + var replyPingAf string + if err := testSectRPC.Call(utils.CDRsV1Ping, &utils.CGREvent{}, &replyPingAf); err != nil { + t.Error(err) + } else if replyPingAf != utils.Pong { + t.Errorf("Expected OK received: %s", replyPingAf) + } } func testSectConfigSReloadERS(t *testing.T) { @@ -462,6 +530,13 @@ func testSectConfigSReloadEES(t *testing.T) { func testSectConfigSReloadSessions(t *testing.T) { + var replyPingBf string + if err := testSectRPC.Call(utils.SessionSv1Ping, &utils.CGREvent{}, &replyPingBf); err != nil { + 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", @@ -481,6 +556,13 @@ func testSectConfigSReloadSessions(t *testing.T) { } else if cfgStr != rpl { t.Errorf("\nExpected %+v ,\n received: %+v", utils.ToIJSON(cfgStr), utils.ToIJSON(rpl)) } + + var replyPingAf string + if err := testSectRPC.Call(utils.SessionSv1Ping, &utils.CGREvent{}, &replyPingAf); err != nil { + t.Error(err) + } else if replyPingAf != utils.Pong { + t.Errorf("Expected OK received: %s", replyPingAf) + } } func testSectConfigSReloadAsteriskAgent(t *testing.T) { @@ -646,6 +728,13 @@ func testSectConfigSReloadAttributes(t *testing.T) { func testSectConfigSReloadChargers(t *testing.T) { + var replyPingBf string + if err := testSectRPC.Call(utils.ChargerSv1Ping, &utils.CGREvent{}, &replyPingBf); err != nil { + 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", @@ -665,10 +754,24 @@ func testSectConfigSReloadChargers(t *testing.T) { } else if cfgStr != rpl { t.Errorf("\nExpected %+v ,\n received: %+v", utils.ToIJSON(cfgStr), utils.ToIJSON(rpl)) } + + var replyPingAf string + if err := testSectRPC.Call(utils.ChargerSv1Ping, &utils.CGREvent{}, &replyPingAf); err != nil { + t.Error(err) + } else if replyPingAf != utils.Pong { + t.Errorf("Expected OK received: %s", replyPingAf) + } } func testSectConfigSReloadResources(t *testing.T) { + var replyPingBf string + if err := testSectRPC.Call(utils.ResourceSv1Ping, &utils.CGREvent{}, &replyPingBf); err != nil { + 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", @@ -688,10 +791,24 @@ func testSectConfigSReloadResources(t *testing.T) { } else if cfgStr != rpl { t.Errorf("\nExpected %+v ,\n received: %+v", utils.ToIJSON(cfgStr), utils.ToIJSON(rpl)) } + + var replyPingAf string + if err := testSectRPC.Call(utils.ResourceSv1Ping, &utils.CGREvent{}, &replyPingAf); err != nil { + t.Error(err) + } else if replyPingAf != utils.Pong { + t.Errorf("Expected OK received: %s", replyPingAf) + } } func testSectConfigSReloadStats(t *testing.T) { + var replyPingBf string + if err := testSectRPC.Call(utils.StatSv1Ping, &utils.CGREvent{}, &replyPingBf); err != nil { + 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", @@ -711,6 +828,13 @@ func testSectConfigSReloadStats(t *testing.T) { } else if cfgStr != rpl { t.Errorf("\nExpected %+v ,\n received: %+v", utils.ToIJSON(cfgStr), utils.ToIJSON(rpl)) } + var replyPingAf string + if err := testSectRPC.Call(utils.StatSv1Ping, &utils.CGREvent{}, &replyPingAf); err != nil { + t.Error(err) + } else if replyPingAf != utils.Pong { + t.Errorf("Expected OK received: %s", replyPingAf) + } + } func testSectConfigSReloadThresholds(t *testing.T) { @@ -751,6 +875,12 @@ func testSectConfigSReloadThresholds(t *testing.T) { func testSectConfigSReloadRoutes(t *testing.T) { + var replyPingBf string + if err := testSectRPC.Call(utils.RouteSv1Ping, &utils.CGREvent{}, &replyPingBf); err != nil { + 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", @@ -770,6 +900,13 @@ func testSectConfigSReloadRoutes(t *testing.T) { } else if cfgStr != rpl { t.Errorf("\nExpected %+v ,\n received: %+v", utils.ToIJSON(cfgStr), utils.ToIJSON(rpl)) } + + var replyPingAf string + if err := testSectRPC.Call(utils.RouteSv1Ping, &utils.CGREvent{}, &replyPingAf); err != nil { + t.Error(err) + } else if replyPingAf != utils.Pong { + t.Errorf("Expected OK received: %s", replyPingAf) + } } func testSectConfigSReloadLoaders(t *testing.T) { @@ -890,6 +1027,12 @@ func testSectConfigSReloadMigrator(t *testing.T) { func testSectConfigSReloadDispatchers(t *testing.T) { + var replyPingBf string + if err := testSectRPC.Call(utils.DispatcherSv1Ping, &utils.CGREvent{}, &replyPingBf); err != nil { + 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", @@ -909,6 +1052,13 @@ func testSectConfigSReloadDispatchers(t *testing.T) { } else if cfgStr != rpl { t.Errorf("\nExpected %+v ,\n received: %+v", utils.ToIJSON(cfgStr), utils.ToIJSON(rpl)) } + + var replyPingAf string + if err := testSectRPC.Call(utils.DispatcherSv1Ping, &utils.CGREvent{}, &replyPingAf); err != nil { + t.Error(err) + } else if replyPingAf != utils.Pong { + t.Errorf("Expected OK received: %s", replyPingAf) + } } func testSectConfigSReloadRegistrarC(t *testing.T) { @@ -1047,6 +1197,7 @@ func testSectConfigSReloadConfigs(t *testing.T) { } else if cfgStr != rpl { t.Errorf("\nExpected %+v ,\n received: %+v", utils.ToIJSON(cfgStr), utils.ToIJSON(rpl)) } + } func testSectConfigSReloadAPIBan(t *testing.T) {