Changeset View
Changeset View
Standalone View
Standalone View
src/test/test_bitcoin.cpp
Show First 20 Lines • Show All 77 Lines • ▼ Show 20 Lines | TestingSetup::TestingSetup(const std::string &chainName) | ||||
: BasicTestingSetup(chainName) { | : BasicTestingSetup(chainName) { | ||||
const Config &config = GetConfig(); | const Config &config = GetConfig(); | ||||
const CChainParams &chainparams = config.GetChainParams(); | const CChainParams &chainparams = config.GetChainParams(); | ||||
// Ideally we'd move all the RPC tests to the functional testing framework | // Ideally we'd move all the RPC tests to the functional testing framework | ||||
// instead of unit tests, but for now we need these here. | // instead of unit tests, but for now we need these here. | ||||
RPCServer rpcServer; | RPCServer rpcServer; | ||||
RegisterAllRPCCommands(config, rpcServer, tableRPC); | RegisterAllRPCCommands(config, rpcServer, tableRPC); | ||||
/** | |||||
* This fixes a bug which is not apparent in most tests since test coverage | |||||
deadalnix: Either the bug still exists, and this clearly doesn't fix it, or this actually fixes the bug… | |||||
jasonbcoxAuthorUnsubmitted Done Inline ActionsMoved to D2507 jasonbcox: Moved to D2507 | |||||
* for RPC code is either poor or non-existent. RPC does not come out of | |||||
* warmup state on its own and requires intervention by the testing | |||||
* framework if the full bitcoind init path is not taken. | |||||
*/ | |||||
std::string rpcWarmupStatus; | |||||
if (RPCIsInWarmup(&rpcWarmupStatus)) { | |||||
SetRPCWarmupFinished(); | |||||
} | |||||
ClearDatadirCache(); | ClearDatadirCache(); | ||||
pathTemp = fs::temp_directory_path() / | pathTemp = fs::temp_directory_path() / | ||||
strprintf("test_bitcoin_%lu_%i", (unsigned long)GetTime(), | strprintf("test_bitcoin_%lu_%i", (unsigned long)GetTime(), | ||||
(int)(InsecureRandRange(100000))); | (int)(InsecureRandRange(100000))); | ||||
fs::create_directories(pathTemp); | fs::create_directories(pathTemp); | ||||
gArgs.ForceSetArg("-datadir", pathTemp.string()); | gArgs.ForceSetArg("-datadir", pathTemp.string()); | ||||
// Note that because we don't bother running a scheduler thread here, | // Note that because we don't bother running a scheduler thread here, | ||||
▲ Show 20 Lines • Show All 182 Lines • Show Last 20 Lines |
Either the bug still exists, and this clearly doesn't fix it, or this actually fixes the bug, in which case the bug doesn't exists anymore in the codebase this comment will be a part of. Either way that doesn't make sense.
If this comes due to specificity in the test environment, then explaining what they are instead of complaining about poor test coverage would be more useful. Improving test coverage as well.
It seems like this doesn't have much to do with the RPCServer class or the rest of this diff anyways, so it should be split.