aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2021-07-28 14:29:53 +0200
committerMarcoFalke <falke.marco@gmail.com>2021-07-28 14:31:11 +0200
commit5e213822f86d9fcd19c0af420831bb3079548479 (patch)
tree80337b6cd50e16389a6e2eb549a584c5823f679d /test
parent93878d2ab5a786c1f22686d56987993af96a9ef3 (diff)
parentd596dba9877e7ead3fb5426cbe7e608fbcbfe3eb (diff)
Merge bitcoin/bitcoin#22530: log: sort logging categories alphabetically
d596dba9877e7ead3fb5426cbe7e608fbcbfe3eb test: assert logging categories are sorted in rpc and help (Jon Atack) 17bbff3b88132c0c95b29b59100456b85e26df75 log, refactor: use guard clause in LogCategoriesList() (Jon Atack) 7c57297319bc386afaf06528778384fe58576ef9 log: sort LogCategoriesList and LogCategoriesString alphabetically (Jon Atack) f720cfa824f1be863349e7016080f8fb1c3c76c2 test: verify number of categories returned by logging RPC (Jon Atack) Pull request description: Sorting the logging categories seems more user-friendly with the number of categories we now have, allowing CLI users to more quickly find a particular category. before ``` $ bitcoin-cli help logging ... The valid logging categories are: net, tor, mempool, http, bench, zmq, walletdb, rpc, estimatefee, addrman, selectcoins, reindex, cmpctblock, rand, prune, proxy, mempoolrej, libevent, coindb, qt, leveldb, validation, i2p, ipc $ bitcoind -h | grep -A8 "debug=<category>" -debug=<category> ... output all debugging information. <category> can be: net, tor, mempool, http, bench, zmq, walletdb, rpc, estimatefee, addrman, selectcoins, reindex, cmpctblock, rand, prune, proxy, mempoolrej, libevent, coindb, qt, leveldb, validation, i2p, ipc. $ bitcoin-cli logging [] '["addrman"]' { "net": false, "tor": true, "mempool": false, "http": false, "bench": false, "zmq": false, "walletdb": false, "rpc": false, "estimatefee": false, "addrman": false, "selectcoins": false, "reindex": false, "cmpctblock": false, "rand": false, "prune": false, "proxy": true, "mempoolrej": false, "libevent": false, "coindb": false, "qt": false, "leveldb": false, "validation": false, "i2p": true, "ipc": false } ``` after ``` $ bitcoin-cli help logging ... The valid logging categories are: addrman, bench, cmpctblock, coindb, estimatefee, http, i2p, ipc, leveldb, libevent, mempool, mempoolrej, net, proxy, prune, qt, rand, reindex, rpc, selectcoins, tor, validation, walletdb, zmq $ bitcoind -h | grep -A8 "debug=<category>" -debug=<category> ... output all debugging information. <category> can be: addrman, bench, cmpctblock, coindb, estimatefee, http, i2p, ipc, leveldb, libevent, mempool, mempoolrej, net, proxy, prune, qt, rand, reindex, rpc, selectcoins, tor, validation, walletdb, zmq. $ bitcoin-cli logging [] '["addrman"]' { "addrman": false, "bench": false, "cmpctblock": false, "coindb": false, "estimatefee": false, "http": false, "i2p": false, "ipc": false, "leveldb": false, "libevent": false, "mempool": false, "mempoolrej": false, "net": false, "proxy": false, "prune": false, "qt": false, "rand": false, "reindex": false, "rpc": false, "selectcoins": false, "tor": false, "validation": false, "walletdb": false, "zmq": false } ``` ACKs for top commit: theStack: re-ACK d596dba9877e7ead3fb5426cbe7e608fbcbfe3eb Tree-SHA512: d546257f562b0a288d1b19a028f1a510aaf21bd21da058e7c84653d305ea8662ecb4647ebefd2b97411f845fe5b0b841d40d3fe6814eefcb8ce82df341dfce22
Diffstat (limited to 'test')
-rwxr-xr-xtest/functional/rpc_misc.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/test/functional/rpc_misc.py b/test/functional/rpc_misc.py
index 52c8fa883d..563f2ea43e 100755
--- a/test/functional/rpc_misc.py
+++ b/test/functional/rpc_misc.py
@@ -54,13 +54,27 @@ class RpcMiscTest(BitcoinTestFramework):
assert_raises_rpc_error(-8, "unknown mode foobar", node.getmemoryinfo, mode="foobar")
- self.log.info("test logging")
+ self.log.info("test logging rpc and help")
+
+ # Test logging RPC returns the expected number of logging categories.
+ assert_equal(len(node.logging()), 24)
+
+ # Test toggling a logging category on/off/on with the logging RPC.
assert_equal(node.logging()['qt'], True)
node.logging(exclude=['qt'])
assert_equal(node.logging()['qt'], False)
node.logging(include=['qt'])
assert_equal(node.logging()['qt'], True)
+ # Test logging RPC returns the logging categories in alphabetical order.
+ sorted_logging_categories = sorted(node.logging())
+ assert_equal(list(node.logging()), sorted_logging_categories)
+
+ # Test logging help returns the logging categories string in alphabetical order.
+ categories = ', '.join(sorted_logging_categories)
+ logging_help = self.nodes[0].help('logging')
+ assert f"valid logging categories are: {categories}" in logging_help
+
self.log.info("test echoipc (testing spawned process in multiprocess build)")
assert_equal(node.echoipc("hello"), "hello")