aboutsummaryrefslogtreecommitdiff
path: root/zenserver-test/zenserver-test.cpp
diff options
context:
space:
mode:
authorPer Larsson <[email protected]>2021-11-01 14:36:39 +0100
committerPer Larsson <[email protected]>2021-11-01 14:36:39 +0100
commitff676a3e570563b2de32b61563b46a828437e4aa (patch)
tree2c7799b8f525c26f18b1cccfaeefa8355f0f9798 /zenserver-test/zenserver-test.cpp
parentUpload cache record before blobs and call finalize when processing upstream t... (diff)
parentMoved declaration of ZenDiskCacheLayer::CacheBucket in the .h (diff)
downloadzen-ff676a3e570563b2de32b61563b46a828437e4aa.tar.xz
zen-ff676a3e570563b2de32b61563b46a828437e4aa.zip
Merge branch 'main' of https://github.com/EpicGames/zen
Diffstat (limited to 'zenserver-test/zenserver-test.cpp')
-rw-r--r--zenserver-test/zenserver-test.cpp27
1 files changed, 15 insertions, 12 deletions
diff --git a/zenserver-test/zenserver-test.cpp b/zenserver-test/zenserver-test.cpp
index 23be9f729..450468bb4 100644
--- a/zenserver-test/zenserver-test.cpp
+++ b/zenserver-test/zenserver-test.cpp
@@ -66,6 +66,7 @@ ZEN_THIRD_PARTY_INCLUDES_END
#endif
using namespace fmt::literals;
+using namespace std::literals;
/*
@@ -126,10 +127,10 @@ public:
m_Headers.reserve(16);
zen::ExtendableStringBuilder<256> RequestBody;
- RequestBody << "GET " << Path << " HTTP/1.1\r\n";
- RequestBody << "Host: " << Server << "\r\n";
- RequestBody << "Accept: */*\r\n";
- RequestBody << "Connection: " << (m_KeepAlive ? "keep-alive" : "close") << "\r\n\r\n"; // TODO: support keep-alive
+ RequestBody << "GET "sv << Path << " HTTP/1.1\r\n"sv;
+ RequestBody << "Host: "sv << Server << "\r\n"sv;
+ RequestBody << "Accept: */*\r\n"sv;
+ RequestBody << "Connection: "sv << (m_KeepAlive ? "keep-alive"sv : "close"sv) << "\r\n\r\n"sv; // TODO: support keep-alive
m_RequestBody = RequestBody;
@@ -460,12 +461,12 @@ using namespace spdlog;
using namespace spdlog::details;
using namespace std::literals;
-class full_formatter final : public spdlog::formatter
+class full_test_formatter final : public spdlog::formatter
{
public:
- full_formatter(std::string_view LogId, std::chrono::time_point<std::chrono::system_clock> Epoch) : m_Epoch(Epoch), m_LogId(LogId) {}
+ full_test_formatter(std::string_view LogId, std::chrono::time_point<std::chrono::system_clock> Epoch) : m_Epoch(Epoch), m_LogId(LogId) {}
- virtual std::unique_ptr<formatter> clone() const override { return std::make_unique<full_formatter>(m_LogId, m_Epoch); }
+ virtual std::unique_ptr<formatter> clone() const override { return std::make_unique<full_test_formatter>(m_LogId, m_Epoch); }
static constexpr bool UseDate = false;
@@ -680,7 +681,7 @@ main(int argc, char** argv)
zen::logging::InitializeLogging();
spdlog::set_level(spdlog::level::debug);
- spdlog::set_formatter(std::make_unique<::logging::full_formatter>("test", std::chrono::system_clock::now()));
+ spdlog::set_formatter(std::make_unique<::logging::full_test_formatter>("test", std::chrono::system_clock::now()));
std::filesystem::path ProgramBaseDir = std::filesystem::path(argv[0]).parent_path();
std::filesystem::path TestBaseDir = ProgramBaseDir.parent_path().parent_path() / ".test";
@@ -1704,11 +1705,12 @@ TEST_CASE("zcache.policy")
zen::IoHash Key;
zen::IoHash PayloadId;
- zen::CbPackage Package = GeneratePackage(Key, PayloadId);
- auto Buf = ToBuffer(Package);
// Store package locally
{
+ zen::CbPackage Package = GeneratePackage(Key, PayloadId);
+ auto Buf = ToBuffer(Package);
+
CHECK(Package.GetAttachments().size() != 0);
cpr::Response Result = cpr::Put(cpr::Url{"{}/{}/{}"_format(LocalCfg.BaseUri, Bucket, Key)},
cpr::Body{(const char*)Buf.GetData(), Buf.GetSize()},
@@ -1761,11 +1763,12 @@ TEST_CASE("zcache.policy")
zen::IoHash Key;
zen::IoHash PayloadId;
- zen::CbPackage Package = GeneratePackage(Key, PayloadId);
- auto Buf = ToBuffer(Package);
// Store package upstream
{
+ zen::CbPackage Package = GeneratePackage(Key, PayloadId);
+ auto Buf = ToBuffer(Package);
+
CHECK(Package.GetAttachments().size() != 0);
cpr::Response Result = cpr::Put(cpr::Url{"{}/{}/{}"_format(UpstreamCfg.BaseUri, Bucket, Key)},
cpr::Body{(const char*)Buf.GetData(), Buf.GetSize()},