Merge bitcoin/bitcoin#25173: test: add coverage for unknown network in -onlynet

055d94d1ab test: add coverage for unknown network in -onlynet (brunoerg)

Pull request description:

  This PR adds test coverage for the following init error by passing an unknown network in -onlynet
  0de36941ec/src/init.cpp (L1311)

ACKs for top commit:
  MarcoFalke:
    rACK 055d94d1ab

Tree-SHA512: 01bbb297afff371f6345889fa04117ff195b68f0bbf934878ba446049791fdbd7d2ce119ee4f9b3616cc0a81330d7055507dc81151acf68532c077f3575258e9
This commit is contained in:
MacroFake 2022-05-20 08:17:34 +01:00
commit d433f59f1e
No known key found for this signature in database
GPG Key ID: CE2B75697E69A548

View File

@ -36,6 +36,7 @@ addnode connect to a CJDNS address
- Test passing invalid -i2psam
- Test passing -onlynet=onion without -proxy or -onion
- Test passing -onlynet=onion with -onion=0 and with -noonion
- Test passing unknown -onlynet
"""
import socket
@ -349,6 +350,11 @@ class ProxyTest(BitcoinTestFramework):
self.nodes[1].extra_args = ["-onlynet=onion", arg]
self.nodes[1].assert_start_raises_init_error(expected_msg=msg)
self.log.info("Test passing unknown network to -onlynet raises expected init error")
self.nodes[1].extra_args = ["-onlynet=abc"]
msg = "Error: Unknown network specified in -onlynet: 'abc'"
self.nodes[1].assert_start_raises_init_error(expected_msg=msg)
if __name__ == '__main__':
ProxyTest().main()