Skip to content
This repository has been archived by the owner on Aug 25, 2021. It is now read-only.

Commit

Permalink
Fix failing Jason unit test (#102, #27)
Browse files Browse the repository at this point in the history
- add Cancelled state to the KnownIceCandidatePairState from the 'medea-client-api-proto' crate
- fix random fails of the web::peer::get_traffic_stats unit test
  • Loading branch information
evdokimovs authored May 29, 2020
1 parent e61d4ad commit e542079
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
14 changes: 8 additions & 6 deletions jason/tests/peer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,7 @@ async fn get_traffic_stats() {
let second_peer_stats = peers.second_peer.get_stats().await.unwrap();
let mut second_peer_video_inbound_stats_count = 0;
let mut second_peer_audio_inbound_stats_count = 0;
let mut has_succeeded_pair = false;
for stat in second_peer_stats.0 {
match stat.stats {
RtcStatsType::InboundRtp(inbound) => {
Expand All @@ -576,16 +577,17 @@ async fn get_traffic_stats() {
"Second Peer shouldn't have any OutboundRtp stats."
),
RtcStatsType::CandidatePair(candidate_pair) => {
// TODO: Fix test race where this assertion might fail cause
// left is `Unknown("cancelled")`.
assert_eq!(
candidate_pair.state,
NonExhaustive::Known(KnownIceCandidatePairState::Succeeded)
);
if let NonExhaustive::Known(
KnownIceCandidatePairState::Succeeded,
) = candidate_pair.state
{
has_succeeded_pair = true;
}
}
_ => (),
}
}
assert!(has_succeeded_pair);
assert_eq!(second_peer_video_inbound_stats_count, 1);
assert_eq!(second_peer_audio_inbound_stats_count, 1);
}
Expand Down
2 changes: 2 additions & 0 deletions proto/client-api/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ All user visible changes to this project will be documented in this file. This p
- `RtcIceCandidateStats`;
- `RtcCertificateStats`;
- `RtcIceServerStats`.
- `Cancelled` state to the `KnownIceCandidatePairState` ([#102]).

[#28]: /../../pull/28
[#58]: /../../pull/58
Expand All @@ -57,6 +58,7 @@ All user visible changes to this project will be documented in this file. This p
[#81]: /../../pull/81
[#87]: /../../pull/87
[#90]: /../../pull/90
[#102]: /../../pull/102



Expand Down
6 changes: 6 additions & 0 deletions proto/client-api/src/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -889,6 +889,12 @@ pub enum KnownIceCandidatePairState {
/// unfreeze and move into the [`KnownIceCandidatePairState::Waiting`]
/// state.
Frozen,

/// Other Candidate pair was nominated.
///
/// This state is **obsolete and not spec compliant**, however, it still
/// may be emitted by some implementations.
Cancelled,
}

/// Non-exhaustive version of [`KnownIceCandidatePairState`].
Expand Down

0 comments on commit e542079

Please sign in to comment.