From 59eb9a9d3a510d0176dcbf0d896beb69f226e9a6 Mon Sep 17 00:00:00 2001 From: Qing Yang Date: Tue, 19 Jan 2021 13:29:47 -0500 Subject: [PATCH 1/2] remove host parameter for net peers command --- programs/cleos/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/programs/cleos/main.cpp b/programs/cleos/main.cpp index 964794eb943..cbd93671edc 100644 --- a/programs/cleos/main.cpp +++ b/programs/cleos/main.cpp @@ -3544,7 +3544,7 @@ int main( int argc, char** argv ) { auto connections = net->add_subcommand("peers", localized("Status of all existing peers")); connections->callback([&] { - const auto& v = call(url, net_connections, new_host); + const auto& v = call(url, net_connections); std::cout << fc::json::to_pretty_string(v) << std::endl; }); From 8e792b1a6c7be5cb84278481b491bf5e2fd9f08c Mon Sep 17 00:00:00 2001 From: Qing Yang Date: Tue, 19 Jan 2021 14:30:11 -0500 Subject: [PATCH 2/2] modify unit tests for net peers --- tests/plugin_http_api_test.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/plugin_http_api_test.py b/tests/plugin_http_api_test.py index dd1e025a4d2..320e81b4edd 100755 --- a/tests/plugin_http_api_test.py +++ b/tests/plugin_http_api_test.py @@ -55,7 +55,8 @@ def startEnv(self) : "eosio::history_plugin", "eosio::history_api_plugin") nodeos_flags = (" --data-dir=%s --trace-dir=%s --trace-no-abis --filter-on=%s --access-control-allow-origin=%s " - "--contracts-console --http-validate-host=%s --verbose-http-errors ") % (self.data_dir, self.data_dir, "\"*\"", "\'*\'", "false") + "--contracts-console --http-validate-host=%s --verbose-http-errors " + "--p2p-peer-address localhost:9011 ") % (self.data_dir, self.data_dir, "\"*\"", "\'*\'", "false") start_nodeos_cmd = ("%s -e -p eosio %s %s ") % (Utils.EosServerPath, nodeos_plugins, nodeos_flags) self.nodeos.launchCmd(start_nodeos_cmd, self.node_id) time.sleep(self.sleep_s) @@ -855,11 +856,11 @@ def test_NetApi(self) : # connections with empty parameter default_cmd = cmd_base + "connections" ret_str = Utils.runCmdReturnStr(default_cmd) - self.assertEqual(ret_str, "[]") + self.assertIn("\"peer\":\"localhost:9011\"", ret_str) # connections with empty content parameter empty_content_cmd = default_cmd + self.http_post_str + self.empty_content_str ret_str = Utils.runCmdReturnStr(default_cmd) - self.assertEqual(ret_str, "[]") + self.assertIn("\"peer\":\"localhost:9011\"", ret_str) # connections with invalid parameter invalid_cmd = default_cmd + self.http_post_str + self.http_post_invalid_param ret_json = Utils.runCmdReturnJson(invalid_cmd)