test: add wait_for_cookie_credentials() to framework for rpcwait tests
Summary:
test: add wait_for_cookie_credentials() to test framework
to be able to ensure the cookie file is written and auth credentials available
when testing CLI/RPC commands before the RPC connection is up.
test: fix intermittent race condition in interface_bitcoin_cli.py
by calling wait_for_cookie_credentials() to ensure the cookie file is written
and auth credentials available for testing the CLI -rpcwait option before the
RPC connection is up.
This is a backport of Core PR18691
Test Plan:
diff --git a/src/httprpc.cpp b/src/httprpc.cpp index 9e09af5a2..8301f8cd1 100644 --- a/src/httprpc.cpp +++ b/src/httprpc.cpp @@ -453,6 +453,7 @@ static bool InitRPCAuthentication() { bool StartHTTPRPC(HTTPRPCRequestProcessor &httpRPCRequestProcessor) { LogPrint(BCLog::RPC, "Starting HTTP RPC server\n"); + UninterruptibleSleep(std::chrono::seconds{11}); if (!InitRPCAuthentication()) { return false; }
ninja && test/functional/test_runner.py interface_bitcoin_cli
Reviewers: #bitcoin_abc, deadalnix, Fabien
Reviewed By: #bitcoin_abc, deadalnix, Fabien
Subscribers: Fabien, deadalnix
Differential Revision: https://reviews.bitcoinabc.org/D8947