memgraph/tests/unit/database_transaction_timeout.cpp
Matej Ferencevic 4e5fe37dd6 Remove virtual and pimpl from single node
Summary:
This diff removes: `SingleNodeRecoveryTransactions`, `TypemapPack`
It also removes virtual and/or pimpl from: `SingleNodeCounters`,
`StorageGcSingleNode`, `SingleNodeConcurrentIdMapper`,
accessors (revert D1510), transaction engine, `GraphDbAccessor`, `GraphDb`

Reviewers: msantl, teon.banek

Reviewed By: msantl, teon.banek

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1639
2018-10-09 11:48:30 +02:00

33 lines
877 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;
database::GraphDb db;
query::Interpreter interpreter;
auto interpret = [&](auto &dba, const std::string &query) {
ResultStreamFaker<query::TypedValue> stream;
interpreter(query, dba, {}, false).PullAll(stream);
};
{
auto dba = db.Access();
interpret(*dba, "MATCH (n) RETURN n");
}
{
auto dba = db.Access();
std::this_thread::sleep_for(std::chrono::seconds(5));
ASSERT_THROW(interpret(*dba, "MATCH (n) RETURN n"),
query::HintedAbortError);
}
{
auto dba = db.Access();
interpret(*dba, "MATCH (n) RETURN n");
}
}