2018-07-06 21:12:45 +08:00
|
|
|
#include "gtest/gtest.h"
|
|
|
|
|
|
|
|
#include "distributed/plan_dispatcher.hpp"
|
|
|
|
#include "distributed_common.hpp"
|
|
|
|
#include "query/context.hpp"
|
2019-03-15 22:58:16 +08:00
|
|
|
#include "query/distributed/plan/ops.hpp"
|
2018-07-06 21:12:45 +08:00
|
|
|
#include "query/interpret/frame.hpp"
|
|
|
|
|
|
|
|
class DistributedReset : public DistributedGraphDbTest {
|
|
|
|
protected:
|
|
|
|
DistributedReset() : DistributedGraphDbTest("reset") {}
|
|
|
|
};
|
|
|
|
|
|
|
|
TEST_F(DistributedReset, ResetTest) {
|
|
|
|
query::SymbolTable symbol_table;
|
|
|
|
auto once = std::make_shared<query::plan::Once>();
|
|
|
|
auto pull_remote = std::make_shared<query::plan::PullRemote>(
|
|
|
|
once, 42, std::vector<query::Symbol>());
|
|
|
|
master().plan_dispatcher().DispatchPlan(42, once, symbol_table);
|
2018-07-26 15:08:21 +08:00
|
|
|
auto dba = master().Access();
|
2018-07-06 21:12:45 +08:00
|
|
|
query::Frame frame(0);
|
2019-01-16 18:30:17 +08:00
|
|
|
query::ExecutionContext context{dba.get()};
|
2019-04-24 17:14:16 +08:00
|
|
|
auto pull_remote_cursor =
|
2019-05-07 20:03:58 +08:00
|
|
|
pull_remote->MakeCursor(dba.get(), utils::NewDeleteResource());
|
2018-07-06 21:12:45 +08:00
|
|
|
|
|
|
|
for (int i = 0; i < 3; ++i) {
|
|
|
|
EXPECT_TRUE(pull_remote_cursor->Pull(frame, context));
|
|
|
|
}
|
|
|
|
EXPECT_FALSE(pull_remote_cursor->Pull(frame, context));
|
|
|
|
|
|
|
|
pull_remote_cursor->Reset();
|
|
|
|
|
|
|
|
for (int i = 0; i < 3; ++i) {
|
|
|
|
EXPECT_TRUE(pull_remote_cursor->Pull(frame, context));
|
|
|
|
}
|
|
|
|
EXPECT_FALSE(pull_remote_cursor->Pull(frame, context));
|
|
|
|
}
|