scripted-diff: Use datadir from options in chainstatemanager test

This should make the test less reliant on details of the test setup

-BEGIN VERIFY SCRIPT-
sed -i 's/m_args.GetDataDirNet()/chainman.m_options.datadir/g' src/test/validation_chainstatemanager_tests.cpp
-END VERIFY SCRIPT-
This commit is contained in:
TheCharlatan 2023-06-13 13:52:26 +02:00
parent 8de9bb7a5a
commit d54819d74e
No known key found for this signature in database
GPG Key ID: 9B79B45691DB4173

View File

@ -184,7 +184,7 @@ struct SnapshotTestSetup : TestChain100Setup {
{
LOCK(::cs_main);
BOOST_CHECK(!chainman.IsSnapshotValidated());
BOOST_CHECK(!node::FindSnapshotChainstateDir(m_args.GetDataDirNet()));
BOOST_CHECK(!node::FindSnapshotChainstateDir(chainman.m_options.datadir));
}
size_t initial_size;
@ -234,7 +234,7 @@ struct SnapshotTestSetup : TestChain100Setup {
auto_infile >> coin;
}));
BOOST_CHECK(!node::FindSnapshotChainstateDir(m_args.GetDataDirNet()));
BOOST_CHECK(!node::FindSnapshotChainstateDir(chainman.m_options.datadir));
BOOST_REQUIRE(!CreateAndActivateUTXOSnapshot(
this, [](AutoFile& auto_infile, SnapshotMetadata& metadata) {
@ -258,7 +258,7 @@ struct SnapshotTestSetup : TestChain100Setup {
}));
BOOST_REQUIRE(CreateAndActivateUTXOSnapshot(this));
BOOST_CHECK(fs::exists(*node::FindSnapshotChainstateDir(m_args.GetDataDirNet())));
BOOST_CHECK(fs::exists(*node::FindSnapshotChainstateDir(chainman.m_options.datadir)));
// Ensure our active chain is the snapshot chainstate.
BOOST_CHECK(!chainman.ActiveChainstate().m_from_snapshot_blockhash->IsNull());
@ -271,7 +271,7 @@ struct SnapshotTestSetup : TestChain100Setup {
{
LOCK(::cs_main);
fs::path found = *node::FindSnapshotChainstateDir(m_args.GetDataDirNet());
fs::path found = *node::FindSnapshotChainstateDir(chainman.m_options.datadir);
// Note: WriteSnapshotBaseBlockhash() is implicitly tested above.
BOOST_CHECK_EQUAL(
@ -382,7 +382,7 @@ struct SnapshotTestSetup : TestChain100Setup {
m_node.notifications = std::make_unique<KernelNotifications>();
const ChainstateManager::Options chainman_opts{
.chainparams = ::Params(),
.datadir = m_args.GetDataDirNet(),
.datadir = chainman.m_options.datadir,
.adjusted_time_callback = GetAdjustedTime,
.notifications = *m_node.notifications,
};
@ -491,7 +491,7 @@ BOOST_FIXTURE_TEST_CASE(chainstatemanager_snapshot_init, SnapshotTestSetup)
this->SetupSnapshot();
fs::path snapshot_chainstate_dir = *node::FindSnapshotChainstateDir(m_args.GetDataDirNet());
fs::path snapshot_chainstate_dir = *node::FindSnapshotChainstateDir(chainman.m_options.datadir);
BOOST_CHECK(fs::exists(snapshot_chainstate_dir));
BOOST_CHECK_EQUAL(snapshot_chainstate_dir, gArgs.GetDataDirNet() / "chainstate_snapshot");
@ -565,7 +565,7 @@ BOOST_FIXTURE_TEST_CASE(chainstatemanager_snapshot_completion, SnapshotTestSetup
SnapshotCompletionResult res;
auto mock_shutdown = [](bilingual_str msg) {};
fs::path snapshot_chainstate_dir = *node::FindSnapshotChainstateDir(m_args.GetDataDirNet());
fs::path snapshot_chainstate_dir = *node::FindSnapshotChainstateDir(chainman.m_options.datadir);
BOOST_CHECK(fs::exists(snapshot_chainstate_dir));
BOOST_CHECK_EQUAL(snapshot_chainstate_dir, gArgs.GetDataDirNet() / "chainstate_snapshot");