Fix flaky find_missing_data_indexes_timeout() test (#32450)
This commit is contained in:
parent
943fba5afd
commit
0a1e641057
|
@ -4505,6 +4505,7 @@ pub mod tests {
|
||||||
solana_entry::entry::{next_entry, next_entry_mut},
|
solana_entry::entry::{next_entry, next_entry_mut},
|
||||||
solana_runtime::bank::{Bank, RewardType},
|
solana_runtime::bank::{Bank, RewardType},
|
||||||
solana_sdk::{
|
solana_sdk::{
|
||||||
|
clock::{DEFAULT_MS_PER_SLOT, DEFAULT_TICKS_PER_SLOT},
|
||||||
hash::{self, hash, Hash},
|
hash::{self, hash, Hash},
|
||||||
instruction::CompiledInstruction,
|
instruction::CompiledInstruction,
|
||||||
message::v0::LoadedAddresses,
|
message::v0::LoadedAddresses,
|
||||||
|
@ -6293,6 +6294,13 @@ pub mod tests {
|
||||||
let ledger_path = get_tmp_ledger_path_auto_delete!();
|
let ledger_path = get_tmp_ledger_path_auto_delete!();
|
||||||
let blockstore = Blockstore::open(ledger_path.path()).unwrap();
|
let blockstore = Blockstore::open(ledger_path.path()).unwrap();
|
||||||
|
|
||||||
|
// Blockstore::find_missing_data_indexes() compares timestamps, so
|
||||||
|
// set a small value for defer_threshold_ticks to avoid flakiness.
|
||||||
|
let defer_threshold_ticks = DEFAULT_TICKS_PER_SLOT / 16;
|
||||||
|
let start_index = 0;
|
||||||
|
let end_index = 50;
|
||||||
|
let max_missing = 9;
|
||||||
|
|
||||||
// Write entries
|
// Write entries
|
||||||
let gap: u64 = 10;
|
let gap: u64 = 10;
|
||||||
let shreds: Vec<_> = (0..64)
|
let shreds: Vec<_> = (0..64)
|
||||||
|
@ -6316,10 +6324,10 @@ pub mod tests {
|
||||||
blockstore.find_missing_data_indexes(
|
blockstore.find_missing_data_indexes(
|
||||||
slot,
|
slot,
|
||||||
timestamp(), // first_timestamp
|
timestamp(), // first_timestamp
|
||||||
0, // defer_threshold_ticks
|
defer_threshold_ticks,
|
||||||
0, // start_index
|
start_index,
|
||||||
50, // end_index
|
end_index,
|
||||||
1, // max_missing
|
max_missing,
|
||||||
),
|
),
|
||||||
empty
|
empty
|
||||||
);
|
);
|
||||||
|
@ -6327,11 +6335,11 @@ pub mod tests {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
blockstore.find_missing_data_indexes(
|
blockstore.find_missing_data_indexes(
|
||||||
slot,
|
slot,
|
||||||
timestamp() - 400, // first_timestamp
|
timestamp() - DEFAULT_MS_PER_SLOT, // first_timestamp
|
||||||
0, // defer_threshold_ticks
|
defer_threshold_ticks,
|
||||||
0, // start_index
|
start_index,
|
||||||
50, // end_index
|
end_index,
|
||||||
9, // max_missing
|
max_missing,
|
||||||
),
|
),
|
||||||
expected
|
expected
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue