Rewrite cache loader to async framework (#1193)

Fixes #1188
This commit is contained in:
Alex Kremer
2024-02-20 19:24:49 +00:00
committed by GitHub
parent 27fe35a2d1
commit 190b5c6a37
21 changed files with 947 additions and 472 deletions

View File

@@ -19,6 +19,8 @@
#include "util/async/AnyStopToken.hpp"
#include <boost/asio/spawn.hpp>
#include <gmock/gmock.h>
#include <gtest/gtest.h>
using namespace util::async;
@@ -36,6 +38,7 @@ struct FakeStopToken {
} // namespace
struct AnyStopTokenTests : public TestWithParam<bool> {};
using AnyStopTokenDeathTest = AnyStopTokenTests;
INSTANTIATE_TEST_CASE_P(AnyStopTokenGroup, AnyStopTokenTests, ValuesIn({true, false}), [](auto const& info) {
return info.param ? "true" : "false";
@@ -57,3 +60,10 @@ TEST_P(AnyStopTokenTests, IsStopRequestedCallPropagated)
EXPECT_EQ(stopToken.isStopRequested(), flag);
EXPECT_EQ(stopToken, flag);
}
TEST_F(AnyStopTokenDeathTest, ConversionToYieldContextAssertsIfUnsupported)
{
EXPECT_DEATH(
[[maybe_unused]] auto unused = static_cast<boost::asio::yield_context>(AnyStopToken{FakeStopToken{}}), ".*"
);
}