Skip to content

Commit 2a3b8b8

Browse files
Merge #6612: test: functional tests for RPC debug
53000e1 chore: use quotes for CLI example for rpc logging (Konstantin Akimov) 1f0f463 docs: extend doc for rpc 'debug' to mention rpc 'logging' (Konstantin Akimov) 07fefb3 tests: add functional tests for RPC debug (Konstantin Akimov) Pull request description: ## Issue being fixed or feature implemented See dashpay/dash-issues#63 ## What was done? Functional tests for RPC `debug`. Extended help for this RPC (mentioning of RPC `logging`) This PR replaces #6480 Lately I noticed that it's not trivial to use `logging` with more than 1 category such as `logging [a, b]` due to requirement to escape quotes, inside quotes while `debug a+b` doesn't require any escaping and easier to type. ## How Has This Been Tested? Run unit / functional tests (by CI) ``` test/functional/test_runner.py -j20 --previous-releases --coverage --extended ``` ## Breaking Changes N/A ## Checklist: - [x] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have added or updated relevant unit/integration/functional/e2e tests - [ ] I have made corresponding changes to the documentation - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_ ACKs for top commit: PastaPastaPasta: utACK 53000e1 kwvg: utACK 53000e1 Tree-SHA512: 4944b9b0476600ee993c25149eb18da485c6817fdffbe242f950dbbff16bc5ecd5ed9ad09935ffd00439c0d248a1b8b87504895faf33debf916eb4e714104e8f
2 parents 4275c56 + 53000e1 commit 2a3b8b8

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

src/rpc/misc.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,11 @@ static RPCHelpMan debug()
5151
" - \"all\", \"1\" and \"\" activate all categories at once;\n"
5252
" - \"dash\" activates all Dash-specific categories at once;\n"
5353
" - \"none\" (or \"0\") deactivates all categories at once.\n"
54-
"Note: If specified category doesn't match any of the above, no error is thrown.\n",
54+
"Note: If specified category doesn't match any of the above, no error is thrown.\n"
55+
"Note: Consider using 'logging' RPC which has more features.\n"
56+
" - For 'debug all': logging [\\\"all\\\"]\n"
57+
" - For 'debug none': logging []\n"
58+
" - For 'debug X+Y': logging '[\"X\", \"Y\"]'",
5559
{
5660
{"category", RPCArg::Type::STR, RPCArg::Optional::NO, "The name of the debug category to turn on."},
5761
},
@@ -1239,6 +1243,7 @@ static RPCHelpMan logging()
12391243
},
12401244
RPCExamples{
12411245
HelpExampleCli("logging", "\"[\\\"all\\\"]\" \"[\\\"http\\\"]\"")
1246+
+ HelpExampleCli("logging", "'[\"dash\"]' '[\"llmq\",\"zmq\"]'")
12421247
+ HelpExampleRpc("logging", "[\"all\"], \"[libevent]\"")
12431248
},
12441249
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue

test/functional/rpc_misc.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ def run_test(self):
6262
assert_equal(node.logging()['qt'], False)
6363
node.logging(include=['qt'])
6464
assert_equal(node.logging()['qt'], True)
65+
node.debug('none')
66+
assert_equal(node.logging()['qt'], False)
67+
node.debug('qt')
68+
assert_equal(node.logging()['qt'], True)
6569

6670
# Test logging RPC returns the logging categories in alphabetical order.
6771
sorted_logging_categories = sorted(node.logging())
@@ -71,6 +75,7 @@ def run_test(self):
7175
categories = ', '.join(sorted_logging_categories)
7276
logging_help = self.nodes[0].help('logging')
7377
assert f"valid logging categories are: {categories}" in logging_help
78+
assert f"valid logging categories are: {categories}" in self.nodes[0].help('debug')
7479

7580
self.log.info("test echoipc (testing spawned process in multiprocess build)")
7681
assert_equal(node.echoipc("hello"), "hello")

test/functional/test_runner.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -898,8 +898,6 @@ def _get_uncovered_rpc_commands(self):
898898
covered_cmds.add('voteraw')
899899
# TODO: implement functional tests for getmerkleblocks
900900
covered_cmds.add('getmerkleblocks')
901-
# TODO: drop it with v23+: remove `debug` in favour of `logging`
902-
covered_cmds.add('debug')
903901

904902
if not os.path.isfile(coverage_ref_filename):
905903
raise RuntimeError("No coverage reference found")

0 commit comments

Comments
 (0)