aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBertrand Jacquin <bertrand@jacquin.bzh>2024-04-04 22:33:16 +0100
committerBertrand Jacquin <bertrand@jacquin.bzh>2024-04-06 14:50:40 +0100
commit644e06a9091825b86f1df178fa91463b58686030 (patch)
treefca4a6b2605c93991cdfc2e7b47f4f42d35ae6a4 /tests
parentMerge pull request #9243 (diff)
downloadmonero-644e06a9091825b86f1df178fa91463b58686030.tar.xz
net: define IPv4 object explicitly
Modify all IPv4 variables, function arguments name and daemon arguments to IPv4 specific naming to raise consistency with IPv6. This change is done in order to make source code more legible before addressing #8818. * --p2p-bind-ip is replaced with --p2p-bind-ipv4-address * --p2p-bind-port is replaced with --p2p-bind-port-ipv4 * --rpc-bind-ip is replaced with --rpc-bind-ipv4-address * --rpc-restricted-bind-ip is replaced with --rpc-restricted-bind-ipv4-address Bug: https://github.com/monero-project/monero/issues/8818
Diffstat (limited to 'tests')
-rwxr-xr-xtests/functional_tests/functional_tests_rpc.py2
-rw-r--r--tests/trezor/daemon.cpp8
-rw-r--r--tests/unit_tests/node_server.cpp8
3 files changed, 9 insertions, 9 deletions
diff --git a/tests/functional_tests/functional_tests_rpc.py b/tests/functional_tests/functional_tests_rpc.py
index 7e4d49ffa..8c8a8cfd0 100755
--- a/tests/functional_tests/functional_tests_rpc.py
+++ b/tests/functional_tests/functional_tests_rpc.py
@@ -52,7 +52,7 @@ WALLET_DIRECTORY = builddir + "/functional-tests-directory"
FUNCTIONAL_TESTS_DIRECTORY = builddir + "/tests/functional_tests"
DIFFICULTY = 10
-monerod_base = [builddir + "/bin/monerod", "--regtest", "--fixed-difficulty", str(DIFFICULTY), "--no-igd", "--p2p-bind-port", "monerod_p2p_port", "--rpc-bind-port", "monerod_rpc_port", "--zmq-rpc-bind-port", "monerod_zmq_port", "--zmq-pub", "monerod_zmq_pub", "--non-interactive", "--disable-dns-checkpoints", "--check-updates", "disabled", "--rpc-ssl", "disabled", "--data-dir", "monerod_data_dir", "--log-level", "1"]
+monerod_base = [builddir + "/bin/monerod", "--regtest", "--fixed-difficulty", str(DIFFICULTY), "--no-igd", "--p2p-bind-port-ipv4", "monerod_p2p_port", "--rpc-bind-port", "monerod_rpc_port", "--zmq-rpc-bind-port", "monerod_zmq_port", "--zmq-pub", "monerod_zmq_pub", "--non-interactive", "--disable-dns-checkpoints", "--check-updates", "disabled", "--rpc-ssl", "disabled", "--data-dir", "monerod_data_dir", "--log-level", "1"]
monerod_extra = [
["--offline"],
["--rpc-payment-address", "44SKxxLQw929wRF6BA9paQ1EWFshNnKhXM3qz6Mo3JGDE2YG3xyzVutMStEicxbQGRfrYvAAYxH6Fe8rnD56EaNwUiqhcwR", "--rpc-payment-difficulty", str(DIFFICULTY), "--rpc-payment-credits", "5000", "--offline"],
diff --git a/tests/trezor/daemon.cpp b/tests/trezor/daemon.cpp
index de4f9bc51..308fa6fc0 100644
--- a/tests/trezor/daemon.cpp
+++ b/tests/trezor/daemon.cpp
@@ -55,7 +55,7 @@ void mock_daemon::default_options(boost::program_options::variables_map & vm)
std::vector<std::string> exclusive_nodes{"127.0.0.1:65525"};
tools::options::set_option(vm, nodetool::arg_p2p_add_exclusive_node, po::variable_value(exclusive_nodes, false));
- tools::options::set_option(vm, nodetool::arg_p2p_bind_ip, po::variable_value(std::string("127.0.0.1"), false));
+ tools::options::set_option(vm, nodetool::arg_p2p_bind_ipv4_address, po::variable_value(std::string("127.0.0.1"), false));
tools::options::set_option(vm, nodetool::arg_no_igd, po::variable_value(true, false));
tools::options::set_option(vm, cryptonote::arg_offline, po::variable_value(true, false));
tools::options::set_option(vm, "disable-dns-checkpoints", po::variable_value(true, false));
@@ -69,7 +69,7 @@ void mock_daemon::default_options(boost::program_options::variables_map & vm)
// By default pick non-standard ports to avoid confusion with possibly locally running daemons (mainnet/testnet)
const char *test_p2p_port = getenv("TEST_P2P_PORT");
auto p2p_port = std::string(test_p2p_port && strlen(test_p2p_port) > 0 ? test_p2p_port : "61340");
- tools::options::set_option(vm, nodetool::arg_p2p_bind_port, po::variable_value(p2p_port, false));
+ tools::options::set_option(vm, nodetool::arg_p2p_bind_port_ipv4, po::variable_value(p2p_port, false));
const char *test_rpc_port = getenv("TEST_RPC_PORT");
auto rpc_port = std::string(test_rpc_port && strlen(test_rpc_port) > 0 ? test_rpc_port : "61341");
@@ -85,7 +85,7 @@ void mock_daemon::default_options(boost::program_options::variables_map & vm)
void mock_daemon::set_ports(boost::program_options::variables_map & vm, unsigned initial_port)
{
CHECK_AND_ASSERT_THROW_MES(initial_port < 65535-2, "Invalid port number");
- tools::options::set_option(vm, nodetool::arg_p2p_bind_port, po::variable_value(std::to_string(initial_port), false));
+ tools::options::set_option(vm, nodetool::arg_p2p_bind_port_ipv4, po::variable_value(std::to_string(initial_port), false));
tools::options::set_option(vm, cryptonote::core_rpc_server::arg_rpc_bind_port, po::variable_value(std::to_string(initial_port + 1), false));
tools::options::set_option(vm, daemon_args::arg_zmq_rpc_bind_port, po::variable_value(std::to_string(initial_port + 2), false));
po::notify(vm);
@@ -93,7 +93,7 @@ void mock_daemon::set_ports(boost::program_options::variables_map & vm, unsigned
void mock_daemon::load_params(boost::program_options::variables_map const & vm)
{
- m_p2p_bind_port = command_line::get_arg(vm, nodetool::arg_p2p_bind_port);
+ m_p2p_bind_port = command_line::get_arg(vm, nodetool::arg_p2p_bind_port_ipv4);
m_rpc_bind_port = command_line::get_arg(vm, cryptonote::core_rpc_server::arg_rpc_bind_port);
m_zmq_bind_port = command_line::get_arg(vm, daemon_args::arg_zmq_rpc_bind_port);
m_network_type = command_line::get_arg(vm, cryptonote::arg_testnet_on) ? cryptonote::TESTNET : cryptonote::MAINNET;
diff --git a/tests/unit_tests/node_server.cpp b/tests/unit_tests/node_server.cpp
index 6f490d7b9..584ca3d63 100644
--- a/tests/unit_tests/node_server.cpp
+++ b/tests/unit_tests/node_server.cpp
@@ -309,8 +309,8 @@ TEST(node_server, bind_same_p2p_port)
For Mac OSX and OpenBSD, set the following alias (by running the command as root), before running the test, or else it will fail:
ifconfig lo0 alias 127.0.0.2
*/
- vm.find(nodetool::arg_p2p_bind_ip.name)->second = boost::program_options::variable_value(std::string("127.0.0.2"), false);
- vm.find(nodetool::arg_p2p_bind_port.name)->second = boost::program_options::variable_value(std::string(port), false);
+ vm.find(nodetool::arg_p2p_bind_ipv4_address.name)->second = boost::program_options::variable_value(std::string("127.0.0.2"), false);
+ vm.find(nodetool::arg_p2p_bind_port_ipv4.name)->second = boost::program_options::variable_value(std::string(port), false);
boost::program_options::notify(vm);
@@ -1140,8 +1140,8 @@ TEST(node_server, race_condition)
options_t options;
boost::program_options::store(
boost::program_options::command_line_parser({
- "--p2p-bind-ip=127.0.0.1",
- "--p2p-bind-port=48080",
+ "--p2p-bind-ipv4-address=127.0.0.1",
+ "--p2p-bind-port-ipv4=48080",
"--out-peers=0",
"--data-dir",
dir.string(),