userver: userver/testsuite/postgres_control.hpp Source File
Loading...
Searching...
No Matches
postgres_control.hpp
Go to the documentation of this file.
1#pragma once
2
3/// @file userver/testsuite/postgres_control.hpp
4/// @brief @copybrief testsuite::PostgresControl
5
6#include <chrono>
7
8#include <userver/engine/deadline.hpp>
9
10USERVER_NAMESPACE_BEGIN
11
12namespace testsuite {
13
14/// @brief Testsuite overrides for PostgreSQL query timeouts
16public:
17 enum class ReadonlyMaster { kNotExpected, kExpected };
18
19 PostgresControl() = default;
20
21 PostgresControl(
22 std::chrono::milliseconds network_timeout,
23 std::chrono::milliseconds statement_timeout,
24 ReadonlyMaster readonly_master
25 );
26
27 [[nodiscard]] engine::Deadline MakeExecuteDeadline(std::chrono::milliseconds duration) const;
28
29 [[nodiscard]] std::chrono::milliseconds MakeStatementTimeout(std::chrono::milliseconds duration) const;
30
31 bool IsReadonlyMasterExpected() const;
32
33private:
34 std::chrono::milliseconds network_timeout_{};
35 std::chrono::milliseconds statement_timeout_{};
36 bool is_readonly_master_expected_{false};
37};
38
39} // namespace testsuite
40
41USERVER_NAMESPACE_END