Skip to content

Commit e4e5beb

Browse files
committed
Increase the time buffer to setup/communicate with test server
This mechanism is used, in the absence of a better one, to wait for the server to completely boot/handle the request before continuing the tests. Also, add more log messages to UDP tests to better indicate the sequence of the test steps.
1 parent c31005f commit e4e5beb

1 file changed

Lines changed: 23 additions & 5 deletions

File tree

libs/udp/test/TestSupport.hpp

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,18 +94,30 @@ class MockServer : public BaseMockServer<MockServer> {
9494
}
9595

9696
Meter get_meter(const std::string& path, const std::string& name) const {
97+
ECF_TEST_DBG(<< " MOCK: Retrieving meter " << name << ", at node " << path << ", from ecFlow server");
9798
node_ptr node = get_node_at(path);
98-
return get_attribute_by_name(node->meters(), name);
99+
auto meter = get_attribute_by_name(node->meters(), name);
100+
ECF_TEST_DBG(<< " MOCK: Meter " << name << ", at node " << path << ", has value :" << meter.value()
101+
<< " in [" << meter.min() << "," << meter.max() << "] (color change at " << meter.colorChange()
102+
<< ")");
103+
return meter;
99104
}
100105

101106
Label get_label(const std::string& path, const std::string& name) const {
107+
ECF_TEST_DBG(<< " MOCK: Retrieving label " << name << ", at node " << path << ", from ecFlow server");
102108
node_ptr node = get_node_at(path);
103-
return get_attribute_by_name(node->labels(), name);
109+
auto label = get_attribute_by_name(node->labels(), name);
110+
ECF_TEST_DBG(<< " MOCK: Label " << name << ", at node " << path << ", has value :" << label.value());
111+
return label;
104112
}
105113

106114
Event get_event(const std::string& path, const std::string& name) const {
115+
ECF_TEST_DBG(<< " MOCK: Retrieving event " << name << ", at node " << path << ", from ecFlow server");
107116
node_ptr node = get_node_at(path);
108-
return get_attribute_by_name(node->events(), name);
117+
auto event = get_attribute_by_name(node->events(), name);
118+
ECF_TEST_DBG(<< " MOCK: Event " << name << ", at node " << path
119+
<< ", has value :" << (event.value() ? "True" : "False"));
120+
return event;
109121
}
110122

111123
private:
@@ -176,20 +188,26 @@ class MockUDPServer : public BaseMockServer<MockUDPServer> {
176188
: BaseMockServer<MockUDPServer>("localhost", port, ecflow_port) {}
177189

178190
void update_label(const std::string& path, const std::string& name, const std::string& value) {
191+
ECF_TEST_DBG(<< " MOCK: Updating label " << name << ", at node " << path << ", to value: " << value
192+
<< ", via ecFlow UDP server");
179193
auto request = format_request(path, "alter_label", name, value);
180194
send(request);
181195
}
182196

183197
void update_meter(const std::string& path, const std::string& name, int value) {
198+
ECF_TEST_DBG(<< " MOCK: Updating meter " << name << ", at node " << path << ", to value: " << value
199+
<< ", via ecFlow UDP server");
184200
auto request = format_request(path, "alter_meter", name, value);
185201
send(request);
186202
}
187203

188204
void clear_event(const std::string& path, const std::string& name) {
205+
ECF_TEST_DBG(<< " MOCK: Clearing event " << name << ", at node " << path << ", via ecFlow UDP server");
189206
auto request = format_request(path, "alter_event", name, "0");
190207
send(request);
191208
}
192209
void set_event(const std::string& path, const std::string& name) {
210+
ECF_TEST_DBG(<< " MOCK: Setting event " << name << ", at node " << path << ", via ecFlow UDP server");
193211
auto request = format_request(path, "alter_event", name, "1");
194212
send(request);
195213
}
@@ -226,7 +244,7 @@ class MockUDPServer : public BaseMockServer<MockUDPServer> {
226244
client.send(request);
227245

228246
// Wait for request to flow...
229-
std::this_thread::sleep_for(std::chrono::milliseconds(100));
247+
std::this_thread::sleep_for(std::chrono::milliseconds(500));
230248
}
231249

232250
public:
@@ -243,7 +261,7 @@ class MockUDPServer : public BaseMockServer<MockUDPServer> {
243261
{"--port", std::to_string(port), "--ecflow_port", std::to_string(ecflow_port), "--verbose"});
244262

245263
// Wait for server to start...
246-
std::this_thread::sleep_for(std::chrono::milliseconds(2500));
264+
std::this_thread::sleep_for(std::chrono::milliseconds(5000));
247265

248266
return server;
249267
}

0 commit comments

Comments
 (0)