Skip to content

Commit

Permalink
rm_stm_tests: fix broken test
Browse files Browse the repository at this point in the history
The test is broken since commit 34ae66c that inadverdently switched
the batch generator to generate more than one batch per transaction and
that broke certain test invariants.
  • Loading branch information
bharathv committed Jan 9, 2025
1 parent d039fb4 commit b203acf
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions src/v/cluster/tests/rm_stm_tests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,22 @@ static batches_with_identity make_rreader(
int first_seq,
int count,
bool is_transactional) {
return batches_with_identity{
.id = model::
batch_identity{.pid = pid, .first_seq = first_seq, .last_seq = first_seq + count - 1, .record_count = count, .is_transactional = is_transactional},
.batches = random_batches(model::test::record_batch_spec{
.offset = model::offset(0),
.allow_compression = true,
.count = count,
.producer_id = pid.id,
.producer_epoch = pid.epoch,
.base_sequence = first_seq,
.is_transactional = is_transactional})
.get()};
batches_with_identity result;
result.id = {
.pid = pid,
.first_seq = first_seq,
.last_seq = first_seq + count - 1,
.record_count = count,
.is_transactional = is_transactional};
result.batches.push_back(model::test::make_random_batch(
{.offset = model::offset(0),
.allow_compression = true,
.count = count,
.producer_id = pid.id,
.producer_epoch = pid.epoch,
.base_sequence = first_seq,
.is_transactional = is_transactional}));
return result;
}

void check_snapshot_sizes(cluster::rm_stm& stm, raft::consensus* c) {
Expand Down

0 comments on commit b203acf

Please sign in to comment.