Skip to content

Commit

Permalink
Increase sleep to miss the deadline in macOS flaky tests (#4636)
Browse files Browse the repository at this point in the history
* 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>
(cherry picked from commit 421bdb2)
  • Loading branch information
elianalf authored and mergify[bot] committed Apr 10, 2024
1 parent d189521 commit 3cb0388
Showing 1 changed file with 28 additions and 25 deletions.
53 changes: 28 additions & 25 deletions test/blackbox/common/DDSBlackboxTestsOwnershipQos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -701,9 +701,11 @@ TEST_P(OwnershipQos, exclusive_kind_non_keyed_reliable_deadline)
PubSubWriter<HelloWorldPubSubType> writer1(TEST_TOPIC_NAME);
PubSubWriter<HelloWorldPubSubType> 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());
Expand All @@ -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());
Expand All @@ -778,9 +780,10 @@ TEST_P(OwnershipQos, exclusive_kind_keyed_reliable_deadline)
PubSubWriter<KeyedHelloWorldPubSubType> writer1(TEST_TOPIC_NAME);
PubSubWriter<KeyedHelloWorldPubSubType> 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());
Expand All @@ -800,49 +803,49 @@ 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());
data.pop_front();
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());
data.pop_front();
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());
data.pop_front();
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();
Expand All @@ -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();
Expand All @@ -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();
Expand Down

0 comments on commit 3cb0388

Please sign in to comment.