qa: Remove all instances of remove_all except test cleanup

Adds a lint check for `remove_all()`

`fs::remove_all()`/`std::filesystem::remove_all()` is extremely
dangerous, all user-facing instances of it have been removed, and it
also deserves to be removed from the places in our test code where it is
being used unnecessarily.
This commit is contained in:
David Gumberg
2026-01-28 14:57:20 -08:00
parent 667e081a2a
commit a7e4a59d6d
6 changed files with 43 additions and 8 deletions

View File

@@ -44,16 +44,19 @@ static void WalletCreate(benchmark::Bench& bench, bool encrypted)
bilingual_str error_string;
std::vector<bilingual_str> warnings;
auto wallet_path = fs::PathToString(test_setup->m_path_root / "test_wallet");
const auto wallet_path = test_setup->m_path_root / "test_wallet";
const auto wallet_name = fs::PathToString(wallet_path);
bench.run([&] {
auto wallet = CreateWallet(context, wallet_path, /*load_on_start=*/std::nullopt, options, status, error_string, warnings);
auto wallet = CreateWallet(context, wallet_name, /*load_on_start=*/std::nullopt, options, status, error_string, warnings);
assert(status == DatabaseStatus::SUCCESS);
assert(wallet != nullptr);
// Release wallet
RemoveWallet(context, wallet, /*load_on_start=*/ std::nullopt);
WaitForDeleteWallet(std::move(wallet));
fs::remove_all(wallet_path);
fs::remove(wallet_path / "wallet.dat");
fs::remove(wallet_path);
});
}