userver
C++ Async Framework
Loading...
Searching...
No Matches
service_fixtures.hpp
Go to the documentation of this file.
1
#
pragma
once
2
3
/// @file userver/ugrpc/tests/service_fixtures.hpp
4
/// @brief gtest fixtures for testing ugrpc service implementations. Requires
5
/// linking to `userver::grpc-utest`.
6
7
#
include
<
userver
/
utest
/
utest
.
hpp
>
8
#
include
<
userver
/
utils
/
statistics
/
labels
.
hpp
>
9
#
include
<
userver
/
utils
/
statistics
/
testing
.
hpp
>
10
11
#
include
<
userver
/
ugrpc
/
tests
/
service
.
hpp
>
12
13
USERVER_NAMESPACE_BEGIN
14
15
namespace
ugrpc::
tests
{
16
17
/// @see @ref ugrpc::tests::ServiceBase
18
// NOLINTNEXTLINE(fuchsia-multiple-inheritance)
19
class
ServiceFixtureBase
:
protected
ServiceBase
,
public
::testing::Test {
20
protected
:
21
/// @returns the statistics of the server and clients.
22
utils
::statistics::Snapshot
23
GetStatistics
(std::string prefix, std::vector<utils::statistics::Label> require_labels = {});
24
};
25
26
/// @see @ref ugrpc::tests::Service
27
template
<
typename
GrpcService>
28
// NOLINTNEXTLINE(fuchsia-multiple-inheritance)
29
class
ServiceFixture
:
protected
Service
<GrpcService>,
public
::testing::Test {
30
protected
:
31
using
Service
<GrpcService>::
Service
;
32
33
/// @returns the statistics of the server and clients.
34
utils
::statistics::Snapshot
35
GetStatistics
(std::string prefix, std::vector<utils::statistics::Label> require_labels = {}) {
36
return
utils::statistics::Snapshot{
this
->GetStatisticsStorage(), std::move(prefix), std::move(require_labels)};
37
}
38
};
39
40
}
// namespace ugrpc::tests
41
42
USERVER_NAMESPACE_END
userver
ugrpc
tests
service_fixtures.hpp
Generated on Wed Dec 4 2024 18:48:07 for userver by
Doxygen
1.10.0