9b878c91eb
Reviewers: mislav.bradac, teon.banek Reviewed By: teon.banek Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D1079
33 lines
832 B
C++
33 lines
832 B
C++
#include <glog/logging.h>
|
|
#include <gtest/gtest.h>
|
|
|
|
#include "communication/result_stream_faker.hpp"
|
|
#include "query/exceptions.hpp"
|
|
#include "query/interpreter.hpp"
|
|
|
|
DECLARE_int32(query_execution_time_sec);
|
|
|
|
TEST(TransactionTimeout, TransactionTimeout) {
|
|
FLAGS_query_execution_time_sec = 3;
|
|
GraphDb db;
|
|
query::Interpreter interpreter;
|
|
auto interpret = [&](auto &dba, const std::string &query) {
|
|
ResultStreamFaker stream;
|
|
interpreter(query, dba, {}, false).PullAll(stream);
|
|
|
|
};
|
|
{
|
|
GraphDbAccessor dba(db);
|
|
interpret(dba, "MATCH (n) RETURN n");
|
|
}
|
|
{
|
|
GraphDbAccessor dba(db);
|
|
std::this_thread::sleep_for(std::chrono::seconds(5));
|
|
ASSERT_THROW(interpret(dba, "MATCH (n) RETURN n"), query::HintedAbortError);
|
|
}
|
|
{
|
|
GraphDbAccessor dba(db);
|
|
interpret(dba, "MATCH (n) RETURN n");
|
|
}
|
|
}
|