memgraph/tests/unit/counters.cpp
Dominik Gleich 007a7f1a6d Change network design from Start/Shutdown to constructor/destructor
Summary:
Make ServerT start on constructor

Remove shutdown from MasterCoordinator

Distributed system remove Shutdown

Rcp server start and shutdown removed

Reviewers: florijan, mferencevic

Reviewed By: mferencevic

Subscribers: mferencevic, pullbot

Differential Revision: https://phabricator.memgraph.io/D1097
2018-01-10 14:58:57 +01:00

29 lines
788 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);
}