Skip to content

Commit

Permalink
Make sample_lost_be_dw_be_dr_fragments test less flaky (#4620)
Browse files Browse the repository at this point in the history
* Refs #20692. Make sample_lost_be_dw_be_dr_fragments test less flakey.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #20692. Uncrustify.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

---------

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
  • Loading branch information
MiguelCompany committed Mar 27, 2024
1 parent 3263926 commit 33c5635
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions test/blackbox/common/DDSBlackboxTestsListeners.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -765,14 +765,6 @@ void sample_lost_test_dr_init(
PubSubReader<T>& reader,
std::function<void(const eprosima::fastdds::dds::SampleLostStatus& status)> functor)
{
// We want to ensure that samples are only lost due to the custom filter we have set in sample_lost_test_dw_init.
// Since we are going to send 300KB samples in the test for fragments, let's increase the buffer size to avoid any
// other possible loss.
constexpr uint32_t BUFFER_SIZE =
300ul * 1024ul // sample size
* 13ul // number of samples
* 2ul; // 2x to avoid any possible loss
reader.socket_buffer_size(BUFFER_SIZE);
reader.sample_lost_status_functor(functor)
.init();

Expand All @@ -785,6 +777,16 @@ void sample_lost_test_init(
PubSubWriter<T>& writer,
std::function<void(const eprosima::fastdds::dds::SampleLostStatus& status)> functor)
{
// We want to ensure that samples are only lost due to the custom filter we have set in sample_lost_test_dw_init.
// Since we are going to send 300KB samples in the test for fragments, let's increase the buffer size to avoid any
// other possible loss.
constexpr uint32_t BUFFER_SIZE =
300ul * 1024ul // sample size
* 13ul // number of samples
* 2ul; // 2x to avoid any possible loss
reader.socket_buffer_size(BUFFER_SIZE);
writer.socket_buffer_size(BUFFER_SIZE);

sample_lost_test_dw_init(writer);
sample_lost_test_dr_init(reader, functor);

Expand Down

0 comments on commit 33c5635

Please sign in to comment.