From d15bfbe548ee50034ea36136aba0a9f9d7123d46 Mon Sep 17 00:00:00 2001 From: Glauber Costa Date: Wed, 14 Mar 2018 10:33:57 -0400 Subject: [PATCH] tests: change tests to make summary non-copyable Right now the summary can be copied, but in real life there is no reason for this to be a requirement. Tests want it, so we can destroy a summary, load another, and compare the two. We can achieve this by allowing the first summary to be moved, and then we can still have a reference to the second. I am about to make a change that will make the summary not copyable as a requirement, so we need to do this first. Signed-off-by: Glauber Costa --- tests/sstable_datafile_test.cc | 4 ++-- tests/sstable_test.hh | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/sstable_datafile_test.cc b/tests/sstable_datafile_test.cc index a7ec182173..92979b5a49 100644 --- a/tests/sstable_datafile_test.cc +++ b/tests/sstable_datafile_test.cc @@ -4533,12 +4533,12 @@ SEASTAR_TEST_CASE(summary_rebuild_sanity) { }; auto sst = make_sstable_containing(sst_gen, mutations); - summary s1 = sstables::test(sst).get_summary(); + summary s1 = sstables::test(sst).move_summary(); BOOST_REQUIRE(s1.entries.size() > 1); sstables::test(sst).remove_component(sstable::component_type::Summary).get(); sst = reusable_sst(s, tmp->path, 1).get0(); - summary s2 = sstables::test(sst).get_summary(); + summary& s2 = sstables::test(sst).get_summary(); BOOST_REQUIRE(::memcmp(&s1.header, &s2.header, sizeof(summary::header)) == 0); BOOST_REQUIRE(s1.positions == s2.positions); diff --git a/tests/sstable_test.hh b/tests/sstable_test.hh index e2c5e5e1aa..4299481534 100644 --- a/tests/sstable_test.hh +++ b/tests/sstable_test.hh @@ -120,6 +120,10 @@ public: return _sst->_components->summary; } + summary move_summary() { + return std::move(_sst->_components->summary); + } + future<> read_toc() { return _sst->read_toc(); }