Skip to content

Commit

Permalink
flat_mutation_reader_test: fix "test_flat_mutation_reader_consume_sin…
Browse files Browse the repository at this point in the history
…gle_partition"

Since `flat_reader_assertions::produces(const range_tombstone&,...)`
records the range tombstone for checking, be sure to explicitly pass
in a clustering range that does not extend beyond the mock-read part
of the mutation.

Also (provisionally) change the assertion method to accept clustering
ranges.

Signed-off-by: Michael Livshin <michael.livshin@scylladb.com>
  • Loading branch information
Michael Livshin committed Feb 28, 2022
1 parent 34ed752 commit 2221aef
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion test/boost/flat_mutation_reader_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,17 @@ SEASTAR_TEST_CASE(test_flat_mutation_reader_consume_single_partition) {
BOOST_REQUIRE_EQUAL(m.partition().partition_tombstone() ? 1 : 0, result._consume_tombstone_call_count);
auto r2 = assert_that(make_flat_mutation_reader_from_mutations(m.schema(), semaphore.make_permit(), {m}));
r2.produces_partition_start(m.decorated_key(), m.partition().partition_tombstone());
if (result._fragments.empty()) {
continue;
}
query::clustering_row_ranges ck_ranges = {};
if (depth > 1) {
const auto& mf = result._fragments.back();
auto ck_range = query::clustering_range::make_ending_with({mf.position().key(), false});
ck_ranges = {ck_range};
}
for (auto& mf : result._fragments) {
r2.produces(*m.schema(), mf);
r2.produces(*m.schema(), mf, ck_ranges);
}
}
});
Expand Down
2 changes: 1 addition & 1 deletion test/lib/flat_mutation_reader_assertions.hh
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ public:
return *this;
}

flat_reader_assertions& produces(const schema& s, const mutation_fragment& mf) {
flat_reader_assertions& produces(const schema& s, const mutation_fragment& mf, const query::clustering_row_ranges& ck_ranges = {}) {
testlog.trace("Expect {}", mutation_fragment::printer(s, mf));
if (mf.is_range_tombstone()) {
apply_rt(mf.as_range_tombstone());
Expand Down

0 comments on commit 2221aef

Please sign in to comment.