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