diff options
author | Andrew Chow <github@achow101.com> | 2023-06-13 16:26:58 -0400 |
---|---|---|
committer | Andrew Chow <github@achow101.com> | 2023-06-13 16:28:16 -0400 |
commit | 427853ab49f610e971b73ea4cc1d5366747e52b1 (patch) | |
tree | 595e2d525ea6869722846de4832774348c5a28fa | |
parent | da494186f2c0863a294029a5af9c4b57aeb03b40 (diff) | |
parent | d54819d74e04e6105c1f0362755f5bcfa845eefd (diff) | |
download | bitcoin-427853ab49f610e971b73ea4cc1d5366747e52b1.tar.xz |
Merge bitcoin/bitcoin#27876: test: (refactor) Use datadir from options in chainstatemanager test
d54819d74e04e6105c1f0362755f5bcfa845eefd scripted-diff: Use datadir from options in chainstatemanager test (TheCharlatan)
Pull request description:
This should make the test less reliant on argument state from the test setup. This is a follow-up PR as requested in https://github.com/bitcoin/bitcoin/pull/27576#discussion_r1224638890.
ACKs for top commit:
achow101:
ACK d54819d74e04e6105c1f0362755f5bcfa845eefd
MarcoFalke:
lgtm ACK d54819d74e04e6105c1f0362755f5bcfa845eefd
kevkevinpal:
ACK https://github.com/bitcoin/bitcoin/commit/d54819d74e04e6105c1f0362755f5bcfa845eefd
ryanofsky:
Code review ACK d54819d74e04e6105c1f0362755f5bcfa845eefd
Tree-SHA512: 939fde2505c5585d993545a3d05d3a00caec40f860c74fa002caebdf4c1b70e774cfb028a8a8f780525f8968844157d2c568d9f2c8dd5ec32b093173d8644c34
-rw-r--r-- | src/test/validation_chainstatemanager_tests.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/test/validation_chainstatemanager_tests.cpp b/src/test/validation_chainstatemanager_tests.cpp index a09a598332..b797de46af 100644 --- a/src/test/validation_chainstatemanager_tests.cpp +++ b/src/test/validation_chainstatemanager_tests.cpp @@ -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"); |