memgraph/tests/unit/database_transaction_timeout.cpp
Mislav Bradac 31798eb957 Handle index creation correctly
Reviewers: teon.banek, buda

Reviewed By: buda

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D891
2017-10-09 19:22:39 +02:00

40 lines
1.0 KiB
C++

#include <glog/logging.h>
#include "communication/result_stream_faker.hpp"
#include "database/dbms.hpp"
#include "query/exceptions.hpp"
#include "query/interpreter.hpp"
#include <gtest/gtest.h>
DECLARE_int32(query_execution_time_sec);
TEST(TransactionTimeout, TransactionTimeout) {
FLAGS_query_execution_time_sec = 3;
Dbms dbms;
query::Interpreter interpreter;
{
ResultStreamFaker stream;
auto dba1 = dbms.active();
interpreter.Interpret("MATCH (n) RETURN n", *dba1, stream, {}, false);
}
{
ResultStreamFaker stream;
auto dba2 = dbms.active();
std::this_thread::sleep_for(std::chrono::seconds(5));
ASSERT_THROW(
interpreter.Interpret("MATCH (n) RETURN n", *dba2, stream, {}, false),
query::HintedAbortError);
}
{
ResultStreamFaker stream;
auto dba3 = dbms.active();
interpreter.Interpret("MATCH (n) RETURN n", *dba3, stream, {}, false);
}
}
int main(int argc, char **argv) {
google::InitGoogleLogging(argv[0]);
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}