Skip to content

Commit 326a994

Browse files
committed
Problem: Intermittent monitor test failures
Solution: Do not require delayed connection event
1 parent 381f699 commit 326a994

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

tests/monitor.cpp

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,6 @@
99
class mock_monitor_t : public zmq::monitor_t
1010
{
1111
public:
12-
void on_event_connect_delayed(const zmq_event_t &, const char *) ZMQ_OVERRIDE
13-
{
14-
++connect_delayed;
15-
++total;
16-
}
1712

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

2419
int total{0};
25-
int connect_delayed{0};
2620
int connected{0};
2721
};
2822

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

82-
const int expected_event_count = 2;
76+
const int expected_event_count = 1;
8377
monitor.init(s.client, "inproc://foo");
8478

8579
CHECK_FALSE(monitor.check_event(0));
8680
s.init();
8781

88-
while (monitor.check_event(100) && monitor.total < expected_event_count) {
82+
while (monitor.check_event(1000) && monitor.total < expected_event_count) {
8983
}
90-
CHECK(monitor.connect_delayed == 1);
9184
CHECK(monitor.connected == 1);
9285
CHECK(monitor.total == expected_event_count);
9386
}
@@ -137,7 +130,6 @@ TEST_CASE("monitor init abort", "[monitor]")
137130
CHECK(cond_var.wait_for(lock, std::chrono::seconds(1),
138131
[&done] { return done; }));
139132
}
140-
CHECK(monitor.connect_delayed == 1);
141133
CHECK(monitor.connected == 1);
142134
monitor.abort();
143135
thread.join();

0 commit comments

Comments
 (0)