Skip to content

Commit

Permalink
Widen timeout in test so we have fewer CI failures
Browse files Browse the repository at this point in the history
  • Loading branch information
LourensVeen committed Oct 1, 2023
1 parent 039e8d6 commit d9edc33
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions libmuscle/cpp/src/libmuscle/tests/test_profiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ std::chrono::steady_clock::duration communication_interval_() {
#include <libmuscle/profiling.hpp>

#include <chrono>
#include <cstdlib>
#include <time.h>
#include <utility>
#include <gtest/gtest.h>
Expand Down Expand Up @@ -211,7 +212,17 @@ TEST(libmuscle_profiler, test_send_to_mock_mmp_client) {

TEST(libmuscle_profiler, test_send_timeout) {
reset_mocks();
communication_interval = 40ms;

std::chrono::steady_clock::duration wait_time;

if (getenv("CI")) {
communication_interval = 40ms;
wait_time = 500ms;
}
else {
communication_interval = 40ms;
wait_time = 60ms;
}

MockMMPClient mock_mmp_client(Reference("test_instance"), "");
Profiler profiler(mock_mmp_client);
Expand All @@ -220,7 +231,7 @@ TEST(libmuscle_profiler, test_send_timeout) {
ProfileEventType::receive, ProfileTimestamp(), ProfileTimestamp());
profiler.record_event(ProfileEvent(e1));

std::this_thread::sleep_for(50ms);
std::this_thread::sleep_for(wait_time);

ASSERT_EQ(mock_mmp_client.last_submitted_profile_events.size(), 1u);
ASSERT_EQ(mock_mmp_client.last_submitted_profile_events.at(0), e1);
Expand Down

0 comments on commit d9edc33

Please sign in to comment.