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

Generated by: LCOV version 2.1-beta