mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-13 13:27:14 +02:00
703rc/fix port size (#802)
* validate port numbers in client * validate port numbers created at virtual servers and receiver process as tcp ports
This commit is contained in:
@ -5,6 +5,7 @@
|
||||
#include "sls/Detector.h"
|
||||
#include "sls/Version.h"
|
||||
#include "sls/sls_detector_defs.h"
|
||||
#include "test-CmdProxy-global.h"
|
||||
#include <sstream>
|
||||
|
||||
#include "sls/versionAPI.h"
|
||||
@ -237,6 +238,22 @@ TEST_CASE("rx_tcpport", "[.cmd][.rx]") {
|
||||
proxy.Call("rx_tcpport", {}, i, GET, oss);
|
||||
REQUIRE(oss.str() == "rx_tcpport " + std::to_string(port + i) + '\n');
|
||||
}
|
||||
|
||||
test_valid_port("rx_tcpport", {}, -1, PUT);
|
||||
test_valid_port("rx_tcpport", {}, 0, PUT);
|
||||
// should fail for the second module
|
||||
if (det.size() > 1) {
|
||||
test_valid_port("rx_tcpport", {"65535"}, -1, PUT, 65536);
|
||||
auto rxHostname = det.getRxHostname().squash("none");
|
||||
if (rxHostname != "none") {
|
||||
std::ostringstream oss;
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
oss << rxHostname << ":" << 65536 + i << "+";
|
||||
}
|
||||
test_valid_port("rx_hostname", {oss.str()}, -1, PUT, 65536);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setRxPort(prev_val[i], i);
|
||||
}
|
||||
@ -828,6 +845,12 @@ TEST_CASE("rx_zmqport", "[.cmd][.rx]") {
|
||||
std::to_string(port + i * socketsperdetector) +
|
||||
'\n');
|
||||
}
|
||||
test_valid_port("rx_zmqport", {}, -1, PUT);
|
||||
test_valid_port("rx_zmqport", {}, 0, PUT);
|
||||
// should fail for the second module
|
||||
if (det.size() > 1) {
|
||||
test_valid_port("rx_zmqport", {"65535"}, -1, PUT, 65536);
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setRxZmqPort(prev_val_zmqport[i], i);
|
||||
}
|
||||
|
Reference in New Issue
Block a user