Fix tx::WorkerEngine flakyness. Change Endpoint::port type.
Reviewers: mislav.bradac, dgleich Reviewed By: mislav.bradac Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D1054
This commit is contained in:
parent
2758b35c08
commit
52b3941c8a
@ -40,6 +40,6 @@ NetworkEndpoint::NetworkEndpoint(const std::string &addr,
|
||||
const std::string &port)
|
||||
: NetworkEndpoint(addr.c_str(), port.c_str()) {}
|
||||
|
||||
NetworkEndpoint::NetworkEndpoint(const std::string &addr, unsigned short port)
|
||||
NetworkEndpoint::NetworkEndpoint(const std::string &addr, uint16_t port)
|
||||
: NetworkEndpoint(addr.c_str(), std::to_string(port)) {}
|
||||
}
|
||||
|
@ -1,10 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "utils/exceptions.hpp"
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
#include "utils/exceptions.hpp"
|
||||
|
||||
namespace io::network {
|
||||
|
||||
/**
|
||||
@ -17,17 +18,17 @@ class NetworkEndpoint {
|
||||
NetworkEndpoint();
|
||||
NetworkEndpoint(const std::string &addr, const std::string &port);
|
||||
NetworkEndpoint(const char *addr, const char *port);
|
||||
NetworkEndpoint(const std::string &addr, unsigned short port);
|
||||
NetworkEndpoint(const std::string &addr, uint16_t port);
|
||||
|
||||
const char *address() const { return address_; }
|
||||
const char *port_str() const { return port_str_; }
|
||||
int port() const { return port_; }
|
||||
uint16_t port() const { return port_; }
|
||||
unsigned char family() const { return family_; }
|
||||
|
||||
private:
|
||||
char address_[INET6_ADDRSTRLEN];
|
||||
char port_str_[6];
|
||||
unsigned short port_;
|
||||
uint16_t port_;
|
||||
unsigned char family_;
|
||||
};
|
||||
}
|
||||
|
@ -11,14 +11,13 @@ using namespace communication::messaging;
|
||||
|
||||
class WorkerEngineTest : public testing::Test {
|
||||
protected:
|
||||
const static uint16_t master_port_{22345};
|
||||
const std::string local{"127.0.0.1"};
|
||||
|
||||
System master_system_{local, master_port_};
|
||||
System master_system_{local, 0};
|
||||
MasterEngine master_;
|
||||
|
||||
System worker_system_{local, master_port_ + 1};
|
||||
WorkerEngine worker_{worker_system_, local, master_port_};
|
||||
System worker_system_{local, 0};
|
||||
WorkerEngine worker_{worker_system_, local, master_system_.endpoint().port()};
|
||||
|
||||
void SetUp() override { master_.StartServer(master_system_); }
|
||||
void TearDown() override {
|
||||
|
Loading…
Reference in New Issue
Block a user