Changeset View
Changeset View
Standalone View
Standalone View
test/functional/rpcbind_test.py
#!/usr/bin/env python3 | #!/usr/bin/env python3 | ||||
# Copyright (c) 2014-2016 The Bitcoin Core developers | # Copyright (c) 2014-2016 The Bitcoin Core developers | ||||
# Distributed under the MIT software license, see the accompanying | # Distributed under the MIT software license, see the accompanying | ||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php. | # file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
# Test for -rpcbind, as well as -rpcallowip and -rpcconnect | # Test for -rpcbind, as well as -rpcallowip and -rpcconnect | ||||
from platform import uname | |||||
from test_framework.test_framework import BitcoinTestFramework, SkipTest | from test_framework.test_framework import BitcoinTestFramework, SkipTest | ||||
from test_framework.util import * | from test_framework.util import * | ||||
from test_framework.netutil import * | from test_framework.netutil import * | ||||
class RPCBindTest(BitcoinTestFramework): | class RPCBindTest(BitcoinTestFramework): | ||||
def set_test_params(self): | def set_test_params(self): | ||||
self.setup_clean_chain = True | self.setup_clean_chain = True | ||||
Show All 35 Lines | def run_allowip_test(self, allow_ips, rpchost, rpcport): | ||||
rpchost, rpcport)), 0, coveragedir=self.options.coveragedir) | rpchost, rpcport)), 0, coveragedir=self.options.coveragedir) | ||||
node.getnetworkinfo() | node.getnetworkinfo() | ||||
self.stop_nodes() | self.stop_nodes() | ||||
def run_test(self): | def run_test(self): | ||||
# due to OS-specific network stats queries, this test works only on Linux | # due to OS-specific network stats queries, this test works only on Linux | ||||
if not sys.platform.startswith('linux'): | if not sys.platform.startswith('linux'): | ||||
raise SkipTest("This test can only be run on linux.") | raise SkipTest("This test can only be run on linux.") | ||||
# WSL in currently not supported (refer to | |||||
# https://reviews.bitcoinabc.org/T400 for details). | |||||
# This condition should be removed once netstat support is provided by | |||||
# Microsoft. | |||||
if "microsoft" in uname().version.lower(): | |||||
raise SkipTest( | |||||
"Running this test on WSL is currently not supported") | |||||
# find the first non-loopback interface for testing | # find the first non-loopback interface for testing | ||||
non_loopback_ip = None | non_loopback_ip = None | ||||
for name, ip in all_interfaces(): | for name, ip in all_interfaces(): | ||||
if ip != '127.0.0.1': | if ip != '127.0.0.1': | ||||
non_loopback_ip = ip | non_loopback_ip = ip | ||||
break | break | ||||
if non_loopback_ip is None: | if non_loopback_ip is None: | ||||
raise SkipTest( | raise SkipTest( | ||||
▲ Show 20 Lines • Show All 50 Lines • Show Last 20 Lines |