Skip to content

Commit

Permalink
roc-streaminggh-688: Relax checks in public api tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gavv authored and jeshwanthreddy13 committed Aug 6, 2024
1 parent ef1c9cf commit 59a79ba
Showing 1 changed file with 18 additions and 20 deletions.
38 changes: 18 additions & 20 deletions src/tests/public_api/test_loopback_sender_2_receiver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,7 @@ TEST(loopback_sender_2_receiver, multitrack_separate_contexts) {
sender.join();
}

// Smoke test for various counters, durations, etc.
TEST(loopback_sender_2_receiver, metrics_measurements) {
enum {
Flags = test::FlagNonStrict | test::FlagInfinite | test::FlagRTCP,
Expand Down Expand Up @@ -594,8 +595,8 @@ TEST(loopback_sender_2_receiver, metrics_measurements) {
UNSIGNED_LONGS_EQUAL(1, recv_metrics.connection_count);
UNSIGNED_LONGS_EQUAL(1, receiver.conn_metrics_count());

const roc_connection_metrics& recv_conn_metric = receiver.conn_metrics(0);
if (recv_conn_metric.e2e_latency == 0) {
const roc_connection_metrics& recv_conn_metrics = receiver.conn_metrics(0);
if (recv_conn_metrics.e2e_latency == 0 || recv_conn_metrics.mean_jitter == 0) {
continue;
}

Expand All @@ -610,13 +611,22 @@ TEST(loopback_sender_2_receiver, metrics_measurements) {
UNSIGNED_LONGS_EQUAL(1, sender.conn_metrics_count());
const roc_connection_metrics& send_conn_metrics = sender.conn_metrics(0);

if (send_conn_metrics.e2e_latency == 0) {
if (send_conn_metrics.e2e_latency == 0 || send_conn_metrics.mean_jitter == 0) {
continue;
}

UNSIGNED_LONGS_EQUAL(0, recv_conn_metric.lost_packets);
CHECK(send_conn_metrics.e2e_latency > 0);
CHECK(recv_conn_metrics.e2e_latency > 0);

CHECK(send_conn_metrics.expected_packets > 0);
CHECK(recv_conn_metric.expected_packets >= send_conn_metrics.expected_packets);
CHECK(recv_conn_metrics.expected_packets > 0);

CHECK(send_conn_metrics.lost_packets == 0);
CHECK(recv_conn_metrics.lost_packets == 0);

CHECK(send_conn_metrics.mean_jitter > 0);
CHECK(recv_conn_metrics.mean_jitter > 0);

break;
}

Expand All @@ -626,6 +636,7 @@ TEST(loopback_sender_2_receiver, metrics_measurements) {
sender.join();
}

// Check how connection counts are reported.
TEST(loopback_sender_2_receiver, metrics_connections) {
enum {
Flags = test::FlagNonStrict | test::FlagInfinite | test::FlagRTCP,
Expand Down Expand Up @@ -731,7 +742,8 @@ TEST(loopback_sender_2_receiver, metrics_connections) {
sender_2.join();
}

TEST(loopback_sender_2_receiver, metrics_slots) {
// Check how connection counters work for multiple slots.
TEST(loopback_sender_2_receiver, metrics_connections_slots) {
enum {
Flags = test::FlagNonStrict | test::FlagInfinite | test::FlagRTCP,
FrameChans = 2,
Expand Down Expand Up @@ -802,10 +814,6 @@ TEST(loopback_sender_2_receiver, metrics_slots) {
continue;
}

if (receiver.conn_metrics(0).mean_jitter == 0) {
continue;
}

break;
}

Expand All @@ -819,9 +827,6 @@ TEST(loopback_sender_2_receiver, metrics_slots) {

UNSIGNED_LONGS_EQUAL(1, receiver.recv_metrics().connection_count);
UNSIGNED_LONGS_EQUAL(1, receiver.conn_metrics_count());

CHECK(receiver.conn_metrics(0).expected_packets > 0);
CHECK(receiver.conn_metrics(0).mean_jitter > 0);
}

for (;;) {
Expand All @@ -839,10 +844,6 @@ TEST(loopback_sender_2_receiver, metrics_slots) {
continue;
}

if (sender.conn_metrics(0).mean_jitter == 0) {
continue;
}

break;
}

Expand All @@ -856,9 +857,6 @@ TEST(loopback_sender_2_receiver, metrics_slots) {

UNSIGNED_LONGS_EQUAL(1, sender.send_metrics().connection_count);
UNSIGNED_LONGS_EQUAL(1, sender.conn_metrics_count());

CHECK(sender.conn_metrics(0).expected_packets > 0);
CHECK(sender.conn_metrics(0).mean_jitter > 0);
}

receiver.stop();
Expand Down

0 comments on commit 59a79ba

Please sign in to comment.