userver: userver/testsuite/testsuite_support.hpp Source File
⚠️ This is the documentation for an old userver version. Click here to switch to the latest version.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
testsuite_support.hpp
Go to the documentation of this file.
1#pragma once
2
3/// @file userver/testsuite/testsuite_support.hpp
4/// @brief @copybrief components::TestsuiteSupport
5
6#include <userver/components/component_fwd.hpp>
7#include <userver/testsuite/cache_control.hpp>
8#include <userver/testsuite/component_control.hpp>
9#include <userver/testsuite/dump_control.hpp>
10#include <userver/testsuite/grpc_control.hpp>
11#include <userver/testsuite/http_allowed_urls_extra.hpp>
12#include <userver/testsuite/periodic_task_control.hpp>
13#include <userver/testsuite/postgres_control.hpp>
14#include <userver/testsuite/redis_control.hpp>
15#include <userver/testsuite/testpoint_control.hpp>
16
17USERVER_NAMESPACE_BEGIN
18
19/// Testsuite integration
20namespace testsuite {
21class TestsuiteTasks;
22}
23
24namespace components {
25
26// clang-format off
27
28/// @ingroup userver_components
29///
30/// @brief Testsuite support component
31///
32/// Provides additional functionality for testing, e.g. forced cache updates.
33///
34/// ## Static options:
35/// Name | Description | Default value
36/// ---- | ----------- | -------------
37/// testsuite-periodic-update-enabled | whether caches update periodically | true
38/// testsuite-pg-execute-timeout | execute timeout override for postgres | -
39/// testsuite-pg-statement-timeout | statement timeout override for postgres | -
40/// testsuite-pg-readonly-master-expected | mutes readonly master detection warning | false
41/// testsuite-redis-timeout-connect | minimum connection timeout for redis | -
42/// testsuite-redis-timeout-single | minimum single shard timeout for redis | -
43/// testsuite-redis-timeout-all | minimum command timeout for redis | -
44/// testsuite-tasks-enabled | enable testsuite tasks facility | false
45///
46/// ## Static configuration example:
47///
48/// @snippet components/common_component_list_test.cpp Sample testsuite support component config
49
50// clang-format on
51
52class TestsuiteSupport final : public components::impl::ComponentBase {
53 public:
54 /// @ingroup userver_component_names
55 /// @brief The default name of components::TestsuiteSupport
56 static constexpr std::string_view kName = "testsuite-support";
57
58 TestsuiteSupport(const components::ComponentConfig& component_config,
59 const components::ComponentContext& component_context);
60 ~TestsuiteSupport() override;
61
62 testsuite::CacheControl& GetCacheControl();
63 testsuite::ComponentControl& GetComponentControl();
64 testsuite::DumpControl& GetDumpControl();
65 testsuite::PeriodicTaskControl& GetPeriodicTaskControl();
66 testsuite::TestpointControl& GetTestpointControl();
67 const testsuite::PostgresControl& GetPostgresControl();
68 const testsuite::RedisControl& GetRedisControl();
69 testsuite::TestsuiteTasks& GetTestsuiteTasks();
70 testsuite::HttpAllowedUrlsExtra& GetHttpAllowedUrlsExtra();
71 testsuite::GrpcControl& GetGrpcControl();
72
73 static yaml_config::Schema GetStaticConfigSchema();
74
75 private:
76 void OnAllComponentsAreStopping() override;
77
78 testsuite::CacheControl cache_control_;
79 testsuite::ComponentControl component_control_;
80 testsuite::DumpControl dump_control_;
81 testsuite::PeriodicTaskControl periodic_task_control_;
82 testsuite::TestpointControl testpoint_control_;
83 testsuite::PostgresControl postgres_control_;
84 testsuite::RedisControl redis_control_;
85 std::unique_ptr<testsuite::TestsuiteTasks> testsuite_tasks_;
86 testsuite::HttpAllowedUrlsExtra http_allowed_urls_extra_;
87 testsuite::GrpcControl grpc_control_;
88};
89
90template <>
91inline constexpr bool kHasValidate<TestsuiteSupport> = true;
92
93} // namespace components
94
95USERVER_NAMESPACE_END