test: Clear forced -walletdir setting after wallet init_tests

Leaving this value set interfered with the CreateWallet test if it happened to execute later in the test ordering. Specifically it would cause CreateWallet test to write data to the current directory instead of temporary test directory.
This commit is contained in:
Kiminuo 2021-01-15 07:26:51 +00:00
parent 32e59fc371
commit 66576c4fd5

View File

@ -3,6 +3,7 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <fs.h>
#include <univalue.h>
#include <util/check.h>
#include <util/system.h>
@ -37,6 +38,9 @@ InitWalletDirTestingSetup::InitWalletDirTestingSetup(const std::string& chainNam
InitWalletDirTestingSetup::~InitWalletDirTestingSetup()
{
gArgs.LockSettings([&](util::Settings& settings) {
settings.forced_settings.erase("walletdir");
});
fs::current_path(m_cwd);
}