From 421bdb27c88c02dd390fa59f1a6b7f0fe113dc36 Mon Sep 17 00:00:00 2001 From: elianalf <62831776+elianalf@users.noreply.github.com> Date: Wed, 10 Apr 2024 07:28:06 +0200 Subject: [PATCH] Increase sleep to miss the deadline in macOS flaky tests (#4636) * Refs #20653: Increase sleep to miss the deadline in test exclusive_kind_non_keyed_reliable_deadline Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com> * Refs #20653: Increase sleep to miss the deadline in test exclusive_kind_keyed_reliable_deadline Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com> * Refs #20653: Add lease duration and increase deadline Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com> --------- Signed-off-by: elianalf <62831776+elianalf@users.noreply.github.com> --- .../common/DDSBlackboxTestsOwnershipQos.cpp | 53 ++++++++++--------- 1 file changed, 28 insertions(+), 25 deletions(-) diff --git a/test/blackbox/common/DDSBlackboxTestsOwnershipQos.cpp b/test/blackbox/common/DDSBlackboxTestsOwnershipQos.cpp index dc2b92d9ac7..cbe1676f95c 100644 --- a/test/blackbox/common/DDSBlackboxTestsOwnershipQos.cpp +++ b/test/blackbox/common/DDSBlackboxTestsOwnershipQos.cpp @@ -701,9 +701,11 @@ TEST_P(OwnershipQos, exclusive_kind_non_keyed_reliable_deadline) PubSubWriter writer1(TEST_TOPIC_NAME); PubSubWriter writer2(TEST_TOPIC_NAME); - reader.ownership_exclusive().reliability(RELIABLE_RELIABILITY_QOS).deadline_period({0, 100000000}).init(); - writer1.ownership_strength(1).deadline_period({0, 100000000}).init(); - writer2.ownership_strength(2).deadline_period({0, 100000000}).init(); + reader.ownership_exclusive().reliability(RELIABLE_RELIABILITY_QOS).deadline_period({0, 500000000}).lease_duration( + {50, 0}, {3, 0}).init(); + writer1.ownership_strength(1).deadline_period({0, 500000000}).lease_duration({50, 0}, {3, 0}).init(); + writer2.ownership_strength(2).deadline_period({0, 500000000}).lease_duration({50, 0}, {3, 0}).init(); + ASSERT_TRUE(reader.isInitialized()); ASSERT_TRUE(writer1.isInitialized()); @@ -721,46 +723,46 @@ TEST_P(OwnershipQos, exclusive_kind_non_keyed_reliable_deadline) writer1.send_sample(data.front()); data.pop_front(); - std::this_thread::sleep_for(std::chrono::milliseconds(50)); + std::this_thread::sleep_for(std::chrono::milliseconds(20)); writer2.send_sample(data.front()); data.pop_front(); - std::this_thread::sleep_for(std::chrono::milliseconds(50)); + std::this_thread::sleep_for(std::chrono::milliseconds(20)); writer1.send_sample(data.front()); denied_samples.push_back(data.front()); data.pop_front(); - std::this_thread::sleep_for(std::chrono::milliseconds(50)); + std::this_thread::sleep_for(std::chrono::milliseconds(20)); writer2.send_sample(data.front()); data.pop_front(); - std::this_thread::sleep_for(std::chrono::milliseconds(50)); + std::this_thread::sleep_for(std::chrono::milliseconds(20)); writer1.send_sample(data.front()); denied_samples.push_back(data.front()); data.pop_front(); - std::this_thread::sleep_for(std::chrono::milliseconds(50)); + std::this_thread::sleep_for(std::chrono::milliseconds(20)); writer2.send_sample(data.front()); data.pop_front(); - std::this_thread::sleep_for(std::chrono::milliseconds(50)); + std::this_thread::sleep_for(std::chrono::milliseconds(20)); writer1.send_sample(data.front()); denied_samples.push_back(data.front()); data.pop_front(); - std::this_thread::sleep_for(std::chrono::milliseconds(50)); + std::this_thread::sleep_for(std::chrono::milliseconds(500)); writer1.send_sample(data.front()); data.pop_front(); - std::this_thread::sleep_for(std::chrono::milliseconds(50)); + std::this_thread::sleep_for(std::chrono::milliseconds(20)); writer1.send_sample(data.front()); data.pop_front(); - std::this_thread::sleep_for(std::chrono::milliseconds(50)); + std::this_thread::sleep_for(std::chrono::milliseconds(20)); writer1.send_sample(data.front()); data.pop_front(); - std::this_thread::sleep_for(std::chrono::milliseconds(50)); + std::this_thread::sleep_for(std::chrono::milliseconds(20)); reader.block_for_seq({0, 7}); ASSERT_EQ(denied_samples.size(), reader.data_not_received().size()); @@ -778,9 +780,10 @@ TEST_P(OwnershipQos, exclusive_kind_keyed_reliable_deadline) PubSubWriter writer1(TEST_TOPIC_NAME); PubSubWriter writer2(TEST_TOPIC_NAME); - reader.ownership_exclusive().reliability(RELIABLE_RELIABILITY_QOS).deadline_period({0, 100000000}).init(); - writer1.ownership_strength(1).deadline_period({0, 100000000}).init(); - writer2.ownership_strength(2).deadline_period({0, 100000000}).init(); + reader.ownership_exclusive().reliability(RELIABLE_RELIABILITY_QOS).deadline_period({0, 500000000}).lease_duration( + {50, 0}, {3, 0}).init(); + writer1.ownership_strength(1).deadline_period({0, 500000000}).lease_duration({50, 0}, {3, 0}).init(); + writer2.ownership_strength(2).deadline_period({0, 500000000}).lease_duration({50, 0}, {3, 0}).init(); ASSERT_TRUE(reader.isInitialized()); ASSERT_TRUE(writer1.isInitialized()); @@ -800,13 +803,13 @@ TEST_P(OwnershipQos, exclusive_kind_keyed_reliable_deadline) data.pop_front(); writer1.send_sample(data.front()); data.pop_front(); - std::this_thread::sleep_for(std::chrono::milliseconds(50)); + std::this_thread::sleep_for(std::chrono::milliseconds(20)); writer2.send_sample(data.front()); data.pop_front(); writer2.send_sample(data.front()); data.pop_front(); - std::this_thread::sleep_for(std::chrono::milliseconds(50)); + std::this_thread::sleep_for(std::chrono::milliseconds(20)); writer1.send_sample(data.front()); denied_samples.push_back(data.front()); @@ -814,13 +817,13 @@ TEST_P(OwnershipQos, exclusive_kind_keyed_reliable_deadline) writer1.send_sample(data.front()); denied_samples.push_back(data.front()); data.pop_front(); - std::this_thread::sleep_for(std::chrono::milliseconds(50)); + std::this_thread::sleep_for(std::chrono::milliseconds(20)); writer2.send_sample(data.front()); data.pop_front(); writer2.send_sample(data.front()); data.pop_front(); - std::this_thread::sleep_for(std::chrono::milliseconds(50)); + std::this_thread::sleep_for(std::chrono::milliseconds(20)); writer1.send_sample(data.front()); denied_samples.push_back(data.front()); @@ -828,13 +831,13 @@ TEST_P(OwnershipQos, exclusive_kind_keyed_reliable_deadline) writer1.send_sample(data.front()); denied_samples.push_back(data.front()); data.pop_front(); - std::this_thread::sleep_for(std::chrono::milliseconds(50)); + std::this_thread::sleep_for(std::chrono::milliseconds(20)); writer2.send_sample(data.front()); data.pop_front(); writer2.send_sample(data.front()); data.pop_front(); - std::this_thread::sleep_for(std::chrono::milliseconds(50)); + std::this_thread::sleep_for(std::chrono::milliseconds(20)); writer1.send_sample(data.front()); denied_samples.push_back(data.front()); @@ -842,7 +845,7 @@ TEST_P(OwnershipQos, exclusive_kind_keyed_reliable_deadline) writer1.send_sample(data.front()); denied_samples.push_back(data.front()); data.pop_front(); - std::this_thread::sleep_for(std::chrono::milliseconds(50)); + std::this_thread::sleep_for(std::chrono::milliseconds(500)); writer1.send_sample(data.front()); data.pop_front(); @@ -853,7 +856,7 @@ TEST_P(OwnershipQos, exclusive_kind_keyed_reliable_deadline) writer1.send_sample(data.front()); denied_samples.push_back(data.front()); data.pop_front(); - std::this_thread::sleep_for(std::chrono::milliseconds(50)); + std::this_thread::sleep_for(std::chrono::milliseconds(500)); writer1.send_sample(data.front()); data.pop_front(); @@ -864,7 +867,7 @@ TEST_P(OwnershipQos, exclusive_kind_keyed_reliable_deadline) writer1.send_sample(data.front()); denied_samples.push_back(data.front()); data.pop_front(); - std::this_thread::sleep_for(std::chrono::milliseconds(50)); + std::this_thread::sleep_for(std::chrono::milliseconds(500)); writer1.send_sample(data.front()); data.pop_front();