Reduce flakiness of NetworkEmulationManagerTest.ThroughputStats
Bug: webrtc:10138, webrtc:10553 Change-Id: Id7027b94b3a6c072ee48c1291b638f2dc8b8b095 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/133164 Reviewed-by: Sebastian Jansson <srte@webrtc.org> Commit-Queue: Artem Titov <titovartem@webrtc.org> Cr-Commit-Position: refs/heads/master@{#27949}
This commit is contained in:
@ -64,6 +64,7 @@ rtc_source_set("network_emulation_unittest") {
|
||||
deps = [
|
||||
":emulated_network",
|
||||
"../../../api:simulated_network_api",
|
||||
"../../../api/units:time_delta",
|
||||
"../../../call:simulated_network",
|
||||
"../../../rtc_base:gunit_helpers",
|
||||
"../../../rtc_base:logging",
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
#include "absl/memory/memory.h"
|
||||
#include "api/test/simulated_network.h"
|
||||
#include "api/units/time_delta.h"
|
||||
#include "call/simulated_network.h"
|
||||
#include "rtc_base/event.h"
|
||||
#include "rtc_base/gunit.h"
|
||||
@ -252,7 +253,7 @@ TEST(NetworkEmulationManagerTest, Run) {
|
||||
ASSERT_EQ_WAIT(received_stats_count.load(), 2, kStatsWaitTimeoutMs);
|
||||
}
|
||||
|
||||
TEST(NetworkEmulationManagerTest, ThoughputStats) {
|
||||
TEST(NetworkEmulationManagerTest, ThroughputStats) {
|
||||
NetworkEmulationManagerImpl network_manager;
|
||||
|
||||
EmulatedNetworkNode* alice_node = network_manager.CreateEmulatedNode(
|
||||
@ -297,8 +298,6 @@ TEST(NetworkEmulationManagerTest, ThoughputStats) {
|
||||
s2->Send(data.data(), data.size());
|
||||
wait.Wait(100);
|
||||
}
|
||||
EXPECT_EQ(r1.ReceivedCount(), 11);
|
||||
EXPECT_EQ(r2.ReceivedCount(), 11);
|
||||
|
||||
delete s1;
|
||||
delete s2;
|
||||
@ -307,11 +306,14 @@ TEST(NetworkEmulationManagerTest, ThoughputStats) {
|
||||
nt1->GetStats([&](EmulatedNetworkStats st) {
|
||||
EXPECT_EQ(st.packets_sent, 11l);
|
||||
EXPECT_EQ(st.bytes_sent.bytes(), single_packet_size * 11l);
|
||||
EXPECT_NEAR(st.AverageSendRate().bps(), DataRate::bytes_per_sec(1000).bps(),
|
||||
1000);
|
||||
EXPECT_GE(st.last_packet_sent_time - st.first_packet_sent_time,
|
||||
TimeDelta::seconds(1));
|
||||
EXPECT_GT(st.AverageSendRate().bps(), 0);
|
||||
received_stats_count++;
|
||||
});
|
||||
ASSERT_EQ_WAIT(received_stats_count.load(), 1, kStatsWaitTimeoutMs);
|
||||
EXPECT_EQ(r1.ReceivedCount(), 11);
|
||||
EXPECT_EQ(r2.ReceivedCount(), 11);
|
||||
}
|
||||
|
||||
// Testing that packets are delivered via all routes using a routing scheme as
|
||||
|
Reference in New Issue
Block a user