Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem: Intermittent monitor test failures #576

Merged
merged 2 commits into from
Oct 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ jobs:
libzmqbuild: false
brewinstall: "zeromq"
# windows
- os: "windows-2016"
- os: "windows-2019"
cppstd: "14"
cc: "msbuild"
cxx: "msbuild"
Expand Down
12 changes: 2 additions & 10 deletions tests/monitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@
class mock_monitor_t : public zmq::monitor_t
{
public:
void on_event_connect_delayed(const zmq_event_t &, const char *) ZMQ_OVERRIDE
{
++connect_delayed;
++total;
}

void on_event_connected(const zmq_event_t &, const char *) ZMQ_OVERRIDE
{
Expand All @@ -22,7 +17,6 @@ class mock_monitor_t : public zmq::monitor_t
}

int total{0};
int connect_delayed{0};
int connected{0};
};

Expand Down Expand Up @@ -79,15 +73,14 @@ TEST_CASE("monitor init event count", "[monitor]")
common_server_client_setup s{false};
mock_monitor_t monitor;

const int expected_event_count = 2;
const int expected_event_count = 1;
monitor.init(s.client, "inproc://foo");

CHECK_FALSE(monitor.check_event(0));
s.init();

while (monitor.check_event(100) && monitor.total < expected_event_count) {
while (monitor.check_event(1000) && monitor.total < expected_event_count) {
}
CHECK(monitor.connect_delayed == 1);
CHECK(monitor.connected == 1);
CHECK(monitor.total == expected_event_count);
}
Expand Down Expand Up @@ -137,7 +130,6 @@ TEST_CASE("monitor init abort", "[monitor]")
CHECK(cond_var.wait_for(lock, std::chrono::seconds(1),
[&done] { return done; }));
}
CHECK(monitor.connect_delayed == 1);
CHECK(monitor.connected == 1);
monitor.abort();
thread.join();
Expand Down