Mocks and test helpers.
Classes | |
| class | DefaultLoggerFixture |
| Fixture that allows to set the default logger and manages its lifetime. More... | |
| class | DnsServerMock |
| class | HttpServerMock |
| Toy HTTP server for testing; for raw TCP or TLS testing use utest::SimpleServer. More... | |
| class | LogCaptureFixture |
| Fixture that allows to capture and extract log written into the default logger. More... | |
| class | LogCaptureLogger |
| A mocked logger that stores the log records in memory. More... | |
| class | LogRecord |
Represents single log record, typically written via LOG_* macros. More... | |
| class | NotSingleLogError |
| Thrown by GetSingleLog. More... | |
| struct | PrintTestName |
| Test name printer for parameterized tests written in gtest. More... | |
| class | SimpleServer |
| Toy server for simple network testing; for testing HTTP prefer using utest::HttpServerMock. More... | |
Functions | |
| constexpr std::chrono::seconds | kMaxTestWaitTime (20) |
| std::vector< std::string > | CurrentProcessOpenFiles () |
| returns files opened by current process | |
| std::ostream & | operator<< (std::ostream &, const LogRecord &data) |
| std::ostream & | operator<< (std::ostream &, const std::vector< LogRecord > &data) |
| LogRecord | GetSingleLog (utils::span< const LogRecord > log, const utils::impl::SourceLocation &source_location=utils::impl::SourceLocation::Current()) |
| std::shared_ptr< clients::http::Client > | CreateHttpClient () |
| std::shared_ptr< clients::http::Client > | CreateHttpClient (engine::TaskProcessor &fs_task_processor) |
| std::shared_ptr< clients::http::Client > | CreateHttpClientWithPlugin (clients::http::Plugin &) |
| std::shared_ptr< clients::http::Client > | CreateHttpClient (const tracing::TracingManagerBase &tracing_manager) |
| std::vector< std::string > utest::CurrentProcessOpenFiles | ( | ) |
returns files opened by current process
jemalloc opens /proc/sys/vm/overcommit_memory, other libraries may also open some files randomly. To avoid problems in tests and make them reliable check files for specific prefix.
| LogRecord utest::GetSingleLog | ( | utils::span< const LogRecord > | log, |
| const utils::impl::SourceLocation & | source_location = utils::impl::SourceLocation::Current() ) |
log. | NotSingleLogError | if there are zero or multiple log records. |
|
inlineconstexpr |
The maximum time a typical test is allowed to execute. If exceeded, a deadlock is assumed. This time must not be too low to avoid flaky tests.
Use this timeout for awaiting something that is expected to complete. Use appropriate shorter timeouts for awaiting something that is not expected to ever complete.