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

Change eventd ZMQ endpoints from localhost to docker network #923

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
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
8 changes: 4 additions & 4 deletions common/events_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ int running_ut = 0;
*/
#define CFG_VAL map_str_str_t::value_type
const map_str_str_t cfg_default = {
CFG_VAL(XSUB_END_KEY, "tcp://127.0.0.1:5570"),
CFG_VAL(XPUB_END_KEY, "tcp://127.0.0.1:5571"),
CFG_VAL(REQ_REP_END_KEY, "tcp://127.0.0.1:5572"),
CFG_VAL(CAPTURE_END_KEY, "tcp://127.0.0.1:5573"),
CFG_VAL(XSUB_END_KEY, "tcp://240.127.1.1:5570"),
CFG_VAL(XPUB_END_KEY, "tcp://240.127.1.1:5571"),
CFG_VAL(REQ_REP_END_KEY, "tcp://240.127.1.1:5572"),
CFG_VAL(CAPTURE_END_KEY, "tcp://240.127.1.1:5573"),
CFG_VAL(STATS_UPD_SECS, "5"),
CFG_VAL(CACHE_MAX_CNT, "")
};
Expand Down
6 changes: 3 additions & 3 deletions tests/events_common_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ const char *test_cfg_data = "{\

TEST(events_common, get_config)
{
EXPECT_EQ(string("tcp://127.0.0.1:5570"), get_config(string(XSUB_END_KEY)));
EXPECT_EQ(string("tcp://127.0.0.1:5572"), get_config(string(REQ_REP_END_KEY)));
EXPECT_EQ(string("tcp://240.127.1.1:5570"), get_config(string(XSUB_END_KEY)));
EXPECT_EQ(string("tcp://240.127.1.1:5572"), get_config(string(REQ_REP_END_KEY)));
EXPECT_EQ(string("5"), get_config(string(STATS_UPD_SECS)));

ofstream tfile;
Expand All @@ -38,7 +38,7 @@ TEST(events_common, get_config)
EXPECT_EQ(100, get_config_data(CACHE_MAX_CNT, 100));

read_init_config(NULL);
EXPECT_EQ(string("tcp://127.0.0.1:5570"), get_config(string(XSUB_END_KEY)));
EXPECT_EQ(string("tcp://240.127.1.1:5570"), get_config(string(XSUB_END_KEY)));
}

void
Expand Down
18 changes: 18 additions & 0 deletions tests/events_service_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,28 @@ static event_service service_cl, service_svr;
static int server_rd_code, server_ret;
static event_serialized_lst_t server_rd_lst, server_wr_lst;

const char *test_cfg_data_localhost = "{\
\"events\" : { \
\"xsub_path\": \"127.0.0.1:5570\", \
\"req_rep_path\": \"127.0.0.1:5572\" \
}\
}";


/* Mimic the eventd service that handles service requests via dedicated thread */
void serve_commands()
{
int code;
event_serialized_lst_t lst, opt_lst;

ofstream tfile;
const char *tfile_name = "/tmp/init_cfg.json";
tfile.open (tfile_name);
tfile << test_cfg_data_localhost << "\n";
tfile.close();

read_init_config(tfile_name);

EXPECT_EQ(0, service_svr.init_server(zmq_ctx, 1000));
while(!do_terminate) {
if (0 != service_svr.channel_read(code, lst)) {
Expand Down Expand Up @@ -69,6 +86,7 @@ void serve_commands()
EXPECT_EQ(0, service_svr.channel_write(server_ret, server_wr_lst));
}
service_svr.close_service();
read_init_config(NULL);
EXPECT_FALSE(service_svr.is_active());
}

Expand Down
Loading