memgraph/tests/unit/distributed_token_sharing.cpp
Dominik Gleich 1875be1e34 Create Dynamic Graph Partitioner,
Summary:
Count labels in DGP

Add worker_id getter

Replace current_worker_id with worker_id

Add spinner

Add rpc calls for worker counts

Check worker capacity

Migrate to new worker

Fix moving two connected vertices

Token sharing algorithm

Reviewers: msantl, buda

Reviewed By: buda

Subscribers: msantl, pullbot

Differential Revision: https://phabricator.memgraph.io/D1392
2018-05-29 11:32:39 +02:00

34 lines
826 B
C++

#include "distributed_common.hpp"
#include <memory>
#include <thread>
#include <unordered_set>
#include <vector>
#include "gtest/gtest.h"
DECLARE_bool(dynamic_graph_partitioner_enabled);
DECLARE_int32(dgp_max_batch_size);
using namespace distributed;
using namespace database;
class TokenSharingTest : public DistributedGraphDbTest {
void SetUp() override {
FLAGS_dynamic_graph_partitioner_enabled = true;
FLAGS_dgp_max_batch_size = 1;
DistributedGraphDbTest::SetUp();
}
};
TEST_F(TokenSharingTest, Integration) {
auto vb = InsertVertex(worker(1));
for (int i = 0; i < 100; ++i) {
auto v = InsertVertex(master());
InsertEdge(vb, v, "edge");
}
std::this_thread::sleep_for(std::chrono::seconds(3));
// Migrate at least something from or to here
EXPECT_NE(VertexCount(master()), 100);
}