Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
Signed-off-by: Danil-Grigorev <danil.grigorev@suse.com>
  • Loading branch information
Danil-Grigorev committed Dec 28, 2024
1 parent d4ebe7b commit 6b5fdcb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions kube-runtime/src/reflector/dispatcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ where

// Return a number of active subscribers to this shared sender.
pub(crate) fn subscribers(&self) -> usize {
self.dispatch_tx.receiver_count() - 1
self.dispatch_tx.receiver_count()
}
}

Expand Down Expand Up @@ -241,14 +241,16 @@ pub(crate) mod test {

let (_, writer) = reflector::store_shared(10);
let mut subscriber = pin!(writer.subscribe().unwrap());
let mut other_subscriber = pin!(writer.subscribe().unwrap());
let mut reflect = pin!(st.reflect_shared(writer));

// Deleted events should be skipped by subscriber.
assert!(matches!(
poll!(reflect.next()),
Poll::Ready(Some(Ok(Event::Delete(_))))
));
assert_eq!(poll!(subscriber.next()), Poll::Pending);
assert_eq!(poll!(subscriber.next()), Poll::Ready(Some(foo.clone())));
assert_eq!(poll!(other_subscriber.next()), Poll::Ready(Some(foo.clone())));

assert!(matches!(
poll!(reflect.next()),
Expand Down

0 comments on commit 6b5fdcb

Please sign in to comment.