Skip to content

Commit

Permalink
tests: use generated record lsn instead of hardcoded one (#10990)
Browse files Browse the repository at this point in the history
... and start the initial reader with the correct lsn

Closes #10978
  • Loading branch information
VladLazar authored Feb 26, 2025
1 parent 26bda17 commit 622a9de
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions safekeeper/src/send_interpreted_wal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1001,17 +1001,22 @@ mod tests {
const WAL_READER_BATCH_SIZE: usize = 8192;

let start_lsn = Lsn::from_str("0/149FD18").unwrap();
let shard_0_start_lsn = Lsn::from_str("0/14AFE10").unwrap();
let env = Env::new(true).unwrap();
let mut next_record_lsns = Vec::default();
let tli = env
.make_timeline(NodeId(1), TenantTimelineId::generate(), start_lsn)
.await
.unwrap();

let resident_tli = tli.wal_residence_guard().await.unwrap();
let end_watch = Env::write_wal(tli, start_lsn, SIZE, MSG_COUNT, None)
.await
.unwrap();
let end_watch =
Env::write_wal(tli, start_lsn, SIZE, MSG_COUNT, Some(&mut next_record_lsns))
.await
.unwrap();

assert!(next_record_lsns.len() > 3);
let shard_0_start_lsn = next_record_lsns[3];

let end_pos = end_watch.get();

let streaming_wal_reader = StreamingWalReader::new(
Expand Down Expand Up @@ -1064,7 +1069,7 @@ mod tests {
);

let reader_state = reader.state();
let mut reader_fut = std::pin::pin!(reader.run(start_lsn, &None));
let mut reader_fut = std::pin::pin!(reader.run(shard_0_start_lsn, &None));
loop {
let poll = futures::poll!(reader_fut.as_mut());
assert!(poll.is_pending());
Expand Down

1 comment on commit 622a9de

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4382 tests run: 4159 passed, 0 failed, 223 skipped (full report)


Flaky tests (1)

Postgres 17

Test coverage report is not available

The comment gets automatically updated with the latest test results
622a9de at 2025-02-26T15:50:38.751Z :recycle:

Please sign in to comment.