userver: samples/testsuite-support/src/tasks.cpp
Loading...
Searching...
No Matches
samples/testsuite-support/src/tasks.cpp
#include "tasks.hpp"
namespace tests::handlers {
TasksSample::TasksSample(const components::ComponentConfig& config, const components::ComponentContext& context)
: components::ComponentBase(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", [] {
return builder.ExtractValue();
}());
});
} else {
// Proudction code goes here
}
}
} // namespace tests::handlers