5418dfb19e
Summary: Rename redunant port str Add endpoint << operator Migrate everything to endpoint Reviewers: mferencevic, florijan Reviewed By: mferencevic Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D1100
29 lines
794 B
C++
29 lines
794 B
C++
#include "gtest/gtest.h"
|
|
|
|
#include "communication/messaging/distributed.hpp"
|
|
#include "database/counters.hpp"
|
|
|
|
const std::string kLocal = "127.0.0.1";
|
|
|
|
TEST(CountersDistributed, All) {
|
|
communication::messaging::System master_sys({kLocal, 0});
|
|
database::MasterCounters master(master_sys);
|
|
|
|
communication::messaging::System w1_sys({kLocal, 0});
|
|
database::WorkerCounters w1(w1_sys, master_sys.endpoint());
|
|
|
|
communication::messaging::System w2_sys({kLocal, 0});
|
|
database::WorkerCounters w2(w2_sys, master_sys.endpoint());
|
|
|
|
EXPECT_EQ(w1.Get("a"), 0);
|
|
EXPECT_EQ(w1.Get("a"), 1);
|
|
EXPECT_EQ(w2.Get("a"), 2);
|
|
EXPECT_EQ(w1.Get("a"), 3);
|
|
EXPECT_EQ(master.Get("a"), 4);
|
|
|
|
EXPECT_EQ(master.Get("b"), 0);
|
|
EXPECT_EQ(w2.Get("b"), 1);
|
|
w1.Set("b", 42);
|
|
EXPECT_EQ(w2.Get("b"), 42);
|
|
}
|