userver
C++ Async Framework
Loading...
Searching...
No Matches
samples/testsuite-support/src/tasks.cpp
#include "
tasks.hpp
"
#include <
userver/components/component_context.hpp
>
#include <
userver/formats/json/value_builder.hpp
>
#include <
userver/testsuite/tasks.hpp
>
#include <
userver/testsuite/testpoint.hpp
>
namespace
tests::handlers {
TasksSample::TasksSample(
const
components::ComponentConfig
& config,
const
components::ComponentContext
& context)
:
components::LoggableComponentBase
(config, context) {
auto
& testsuite_tasks =
testsuite::GetTestsuiteTasks
(context);
// Only register task for testsuite environment
if
(testsuite_tasks.IsEnabled()) {
testsuite_tasks.RegisterTask(
"sample-task"
, [] {
TESTPOINT
(
"sample-task/action"
, [] {
formats::json::ValueBuilder
builder;
return
builder.
ExtractValue
();
}());
});
}
else
{
// Proudction code goes here
}
}
}
// namespace tests::handlers
Generated on Wed May 15 2024 22:13:58 for userver by
Doxygen
1.10.0