LCOV - code coverage report
Current view: top level - safekeeper/tests - simple_test.rs (source / functions) Coverage Total Hit
Test: 6df3fc19ec669bcfbbf9aba41d1338898d24eaa0.info Lines: 100.0 % 29 29
Test Date: 2025-03-12 18:28:53 Functions: 100.0 % 2 2

            Line data    Source code
       1              : use tracing::info;
       2              : use utils::lsn::Lsn;
       3              : 
       4              : use crate::walproposer_sim::log::init_logger;
       5              : use crate::walproposer_sim::simulation::TestConfig;
       6              : 
       7              : pub mod walproposer_sim;
       8              : 
       9              : // Check that first start of sync_safekeepers() returns 0/0 on empty safekeepers.
      10              : #[test]
      11            1 : fn sync_empty_safekeepers() {
      12            1 :     let clock = init_logger();
      13            1 :     let config = TestConfig::new(Some(clock));
      14            1 :     let test = config.start(1337);
      15            1 : 
      16            1 :     let lsn = test.sync_safekeepers().unwrap();
      17            1 :     assert_eq!(lsn, Lsn(0));
      18            1 :     info!("Sucessfully synced empty safekeepers at 0/0");
      19              : 
      20            1 :     let lsn = test.sync_safekeepers().unwrap();
      21            1 :     assert_eq!(lsn, Lsn(0));
      22            1 :     info!("Sucessfully synced (again) empty safekeepers at 0/0");
      23            1 : }
      24              : 
      25              : // Check that there are no panics when we are writing and streaming WAL to safekeepers.
      26              : #[test]
      27            1 : fn run_walproposer_generate_wal() {
      28            1 :     let clock = init_logger();
      29            1 :     let config = TestConfig::new(Some(clock));
      30            1 :     let test = config.start(1337);
      31            1 : 
      32            1 :     let lsn = test.sync_safekeepers().unwrap();
      33            1 :     assert_eq!(lsn, Lsn(0));
      34            1 :     info!("Sucessfully synced empty safekeepers at 0/0");
      35              : 
      36            1 :     let mut wp = test.launch_walproposer(lsn);
      37            1 : 
      38            1 :     // wait for walproposer to start
      39            1 :     test.poll_for_duration(30);
      40              : 
      41              :     // just write some WAL
      42          101 :     for _ in 0..100 {
      43          100 :         wp.write_tx(1);
      44          100 :         test.poll_for_duration(5);
      45          100 :     }
      46            1 : }
        

Generated by: LCOV version 2.1-beta