mirror of
https://github.com/neondatabase/neon.git
synced 2025-12-27 16:12:56 +00:00
Updates storage components to edition 2024. We like to stay on the latest edition if possible. There is no functional changes, however some code changes had to be done to accommodate the edition's breaking changes. The PR has two commits: * the first commit updates storage crates to edition 2024 and appeases `cargo clippy` by changing code. i have accidentially ran the formatter on some files that had other edits. * the second commit performs a `cargo fmt` I would recommend a closer review of the first commit and a less close review of the second one (as it just runs `cargo fmt`). part of https://github.com/neondatabase/neon/issues/10918
55 lines
1.7 KiB
Rust
55 lines
1.7 KiB
Rust
use rand::Rng;
|
|
use tracing::{info, warn};
|
|
|
|
use crate::walproposer_sim::log::{init_logger, init_tracing_logger};
|
|
use crate::walproposer_sim::simulation::{TestConfig, generate_network_opts, generate_schedule};
|
|
use crate::walproposer_sim::simulation_logs::validate_events;
|
|
|
|
pub mod walproposer_sim;
|
|
|
|
// Generates 500 random seeds and runs a schedule for each of them.
|
|
// If you see this test fail, please report the last seed to the
|
|
// @safekeeper team.
|
|
#[test]
|
|
fn test_random_schedules() -> anyhow::Result<()> {
|
|
let clock = init_logger();
|
|
let mut config = TestConfig::new(Some(clock));
|
|
|
|
for _ in 0..500 {
|
|
let seed: u64 = rand::thread_rng().r#gen();
|
|
config.network = generate_network_opts(seed);
|
|
|
|
let test = config.start(seed);
|
|
warn!("Running test with seed {}", seed);
|
|
|
|
let schedule = generate_schedule(seed);
|
|
test.run_schedule(&schedule).unwrap();
|
|
validate_events(test.world.take_events());
|
|
test.world.deallocate();
|
|
}
|
|
|
|
Ok(())
|
|
}
|
|
|
|
// After you found a seed that fails, you can insert this seed here
|
|
// and run the test to see the full debug output.
|
|
#[test]
|
|
fn test_one_schedule() -> anyhow::Result<()> {
|
|
let clock = init_tracing_logger(true);
|
|
let mut config = TestConfig::new(Some(clock));
|
|
|
|
let seed = 11047466935058776390;
|
|
config.network = generate_network_opts(seed);
|
|
info!("network: {:?}", config.network);
|
|
let test = config.start(seed);
|
|
warn!("Running test with seed {}", seed);
|
|
|
|
let schedule = generate_schedule(seed);
|
|
info!("schedule: {:?}", schedule);
|
|
test.run_schedule(&schedule).unwrap();
|
|
validate_events(test.world.take_events());
|
|
test.world.deallocate();
|
|
|
|
Ok(())
|
|
}
|