Skip to content

Commit

Permalink
added integration test for lossy events_observers
Browse files Browse the repository at this point in the history
  • Loading branch information
rdeioris committed Feb 13, 2025
1 parent 99b993e commit 808d5d0
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions testnet/stacks-node/src/event_dispatcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2485,4 +2485,37 @@ mod test {
// in non lossy mode this will run forever
observer.send_payload(&payload, "/test");
}

#[test]
#[ignore]
/// This test generates a new block and check .
fn tx_submit_with_lossy_observer() {
let dir = tempdir().unwrap();
let working_dir = dir.path().to_path_buf();

let mut event_dispatcher = EventDispatcher::new();
let config = EventObserverConfig {
endpoint: String::from("255.255.255.255"),
events_keys: vec![EventKeyType::MinedBlocks],
timeout_ms: 1000,
lossy: true,
};
event_dispatcher.register_observer(&config, working_dir);

let nakamoto_block = NakamotoBlock {
header: NakamotoBlockHeader::empty(),
txs: vec![],
};

// this will block forever in non lossy mode
event_dispatcher.process_mined_nakamoto_block_event(
0,
&nakamoto_block,
0,
&ExecutionCost::max_value(),
vec![],
);

assert_eq!(event_dispatcher.registered_observers.len(), 1);
}
}

0 comments on commit 808d5d0

Please sign in to comment.