| 35 | |
| 36 | Y_UNIT_TEST_SUITE(ReopenLogSuite) { |
| 37 | Y_UNIT_TEST(TestSimple) { |
| 38 | constexpr ui64 limit = 5; |
| 39 | const auto testData = {"test", "dshkafhuadshfiasuh", "log", "data"}; |
| 40 | constexpr ui64 expectedReopens = 2; // considering the limit, the first reopen after the second string and one more at the end |
| 41 | |
| 42 | auto mockHolder = MakeHolder<TMockLogBackend>(); |
| 43 | auto& mock = *mockHolder; |
| 44 | TReopenLogBackend log(std::move(mockHolder), limit); |
| 45 | |
| 46 | ui64 expectedWritten = 0; |
| 47 | for (const TString str : testData) { |
| 48 | WriteData(log, str); |
| 49 | expectedWritten += str.size(); |
| 50 | } |
| 51 | |
| 52 | UNIT_ASSERT(mock.BytesWritten.load() == expectedWritten); |
| 53 | UNIT_ASSERT(mock.NumReopens.load() == expectedReopens); |
| 54 | } |
| 55 | |
| 56 | Y_UNIT_TEST(TestSingleThreaded) { |
| 57 | constexpr ui64 limit = 1_KB; |
nothing calls this directly
no test coverage detected