LCOV - code coverage report
Current view: top level - safekeeper/tests - simple_test.rs (source / functions) Coverage Total Hit
Test: fcf55189004bd3119eed75e2873a97da8078700c.info Lines: 100.0 % 29 29
Test Date: 2024-06-25 12:07:31 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, simulation::TestConfig};
       5              : 
       6              : pub mod walproposer_sim;
       7              : 
       8              : // Check that first start of sync_safekeepers() returns 0/0 on empty safekeepers.
       9              : #[test]
      10            2 : fn sync_empty_safekeepers() {
      11            2 :     let clock = init_logger();
      12            2 :     let config = TestConfig::new(Some(clock));
      13            2 :     let test = config.start(1337);
      14            2 : 
      15            2 :     let lsn = test.sync_safekeepers().unwrap();
      16            2 :     assert_eq!(lsn, Lsn(0));
      17            2 :     info!("Sucessfully synced empty safekeepers at 0/0");
      18              : 
      19            2 :     let lsn = test.sync_safekeepers().unwrap();
      20            2 :     assert_eq!(lsn, Lsn(0));
      21            2 :     info!("Sucessfully synced (again) empty safekeepers at 0/0");
      22            2 : }
      23              : 
      24              : // Check that there are no panics when we are writing and streaming WAL to safekeepers.
      25              : #[test]
      26            2 : fn run_walproposer_generate_wal() {
      27            2 :     let clock = init_logger();
      28            2 :     let config = TestConfig::new(Some(clock));
      29            2 :     let test = config.start(1337);
      30            2 : 
      31            2 :     let lsn = test.sync_safekeepers().unwrap();
      32            2 :     assert_eq!(lsn, Lsn(0));
      33            2 :     info!("Sucessfully synced empty safekeepers at 0/0");
      34              : 
      35            2 :     let mut wp = test.launch_walproposer(lsn);
      36            2 : 
      37            2 :     // wait for walproposer to start
      38            2 :     test.poll_for_duration(30);
      39              : 
      40              :     // just write some WAL
      41          202 :     for _ in 0..100 {
      42          200 :         wp.write_tx(1);
      43          200 :         test.poll_for_duration(5);
      44          200 :     }
      45            2 : }
        

Generated by: LCOV version 2.1-beta