MCPcopy Create free account
hub / github.com/cncf/gitvote / votes_processor_stops_when_requested

Function votes_processor_stops_when_requested

src/processor.rs:596–614  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

594
595 #[tokio::test]
596 async fn votes_processor_stops_when_requested() {
597 let mut db = MockDB::new();
598 db.expect_close_finished_vote().times(1).returning(|_| Box::pin(future::ready(Ok(None))));
599 db.expect_get_pending_status_checks()
600 .times(1)
601 .returning(|| Box::pin(future::ready(Ok(vec![]))));
602 db.expect_get_open_votes_with_close_on_passing()
603 .times(1)
604 .returning(|| Box::pin(future::ready(Ok(vec![]))));
605 let gh = MockGH::new();
606
607 let (cmds_tx, cmds_rx) = async_channel::unbounded();
608 let cancel_token = CancellationToken::new();
609 let votes_processor = Processor::new(Arc::new(db), Arc::new(gh), cmds_tx, cmds_rx);
610 let votes_processor_handle = votes_processor.run(&cancel_token);
611 cancel_token.cancel();
612
613 assert!(votes_processor_handle.await.iter().all(Result::is_ok));
614 }
615
616 #[tokio::test]
617 async fn commands_handler_stops_when_requested() {

Callers

nothing calls this directly

Calls 1

runMethod · 0.80

Tested by

no test coverage detected