1ca98826af
Summary: Instead of passing `coordination`, pass `rpc_worker_clients` that holds a map of worker_id->clientPool. By having only one instance of `RpcWorkerClients` that is owned by `GraphDB` and passing it by refference we'll share the same client pools for rpc clients. Reviewers: teon.banek, florijan, dgleich, mferencevic Reviewed By: florijan Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D1261
27 lines
727 B
C++
27 lines
727 B
C++
#include "gtest/gtest.h"
|
|
|
|
#include "communication/rpc/server.hpp"
|
|
#include "database/counters.hpp"
|
|
|
|
const std::string kLocal = "127.0.0.1";
|
|
|
|
TEST(CountersDistributed, All) {
|
|
communication::rpc::Server master_server({kLocal, 0});
|
|
database::MasterCounters master(master_server);
|
|
communication::rpc::ClientPool master_client_pool(master_server.endpoint());
|
|
|
|
database::WorkerCounters w1(master_client_pool);
|
|
database::WorkerCounters w2(master_client_pool);
|
|
|
|
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);
|
|
}
|