diff options
Diffstat (limited to 'zenserver-test')
| -rw-r--r-- | zenserver-test/projectclient.cpp | 6 | ||||
| -rw-r--r-- | zenserver-test/zenserver-test.cpp | 145 |
2 files changed, 72 insertions, 79 deletions
diff --git a/zenserver-test/projectclient.cpp b/zenserver-test/projectclient.cpp index 88608bfe0..597838e0d 100644 --- a/zenserver-test/projectclient.cpp +++ b/zenserver-test/projectclient.cpp @@ -19,8 +19,6 @@ namespace zen { -using namespace fmt::literals; - struct ProjectClientConnection { ProjectClientConnection(int BasePort) { Connect(BasePort); } @@ -45,7 +43,7 @@ struct ProjectClientConnection { ZEN_WARN("failed while creating named pipe {}", WideToUtf8(PipeName)); - throw std::system_error(GetLastError(), std::system_category(), "Failed to open named pipe '{}'"_format(WideToUtf8(PipeName))); + throw std::system_error(GetLastError(), std::system_category(), fmt::format("Failed to open named pipe '{}'", WideToUtf8(PipeName))); } // Change to message mode @@ -56,7 +54,7 @@ struct ProjectClientConnection { throw std::system_error(GetLastError(), std::system_category(), - "Failed to change named pipe '{}' to message mode"_format(WideToUtf8(PipeName))); + fmt::format("Failed to change named pipe '{}' to message mode", WideToUtf8(PipeName))); } m_hPipe.Attach(hPipe); // This now owns the handle and will close it diff --git a/zenserver-test/zenserver-test.cpp b/zenserver-test/zenserver-test.cpp index 2266e5305..d5e68caed 100644 --- a/zenserver-test/zenserver-test.cpp +++ b/zenserver-test/zenserver-test.cpp @@ -71,7 +71,6 @@ ZEN_THIRD_PARTY_INCLUDES_END # undef DOCTEST_CONFIG_IMPLEMENT #endif -using namespace fmt::literals; using namespace std::literals; #if ZEN_PLATFORM_LINUX || ZEN_PLATFORM_MAC @@ -173,8 +172,7 @@ private: return; } - using namespace fmt::literals; - zen::ThrowLastError("HTTP client error! '{}'"_format(Error.message())); + zen::ThrowLastError(fmt::format("HTTP client error! '{}'", Error.message())); } int OnHeader(const char* Data, size_t Bytes) @@ -344,8 +342,6 @@ HttpConnectionPool::~HttpConnectionPool() std::unique_ptr<HttpClientConnection> HttpConnectionPool::GetConnection() { - using namespace fmt::literals; - zen::RwLock::ExclusiveLockScope ScopedLock(m_Lock); if (m_AvailableConnections.empty()) @@ -361,7 +357,7 @@ HttpConnectionPool::GetConnection() if (ErrCode) { - zen::ThrowLastError("Unabled to resolve '{}'"_format(m_HostName)); + zen::ThrowLastError(fmt::format("Unabled to resolve '{}'", m_HostName)); } asio::ip::tcp::socket Socket{m_Context}; @@ -369,7 +365,7 @@ HttpConnectionPool::GetConnection() if (ErrCode) { - zen::ThrowLastError("Failed connecting '{}:{}'"_format(m_HostName, m_Port)); + zen::ThrowLastError(fmt::format("Failed connecting '{}:{}'", m_HostName, m_Port)); } return std::make_unique<HttpClientConnection>(m_Context, this, std::move(Socket)); @@ -835,7 +831,7 @@ TEST_CASE("multi.basic") ZEN_INFO("query batch {} started (thread {}) for port {}", BatchNo, ThreadId, PortNumber); cpr::Session cli; - cli.SetUrl(cpr::Url{"http://localhost:{}/test/hello"_format(PortNumber)}); + cli.SetUrl(cpr::Url{fmt::format("http://localhost:{}/test/hello", PortNumber)}); for (int i = 0; i < 10000; ++i) { @@ -877,13 +873,12 @@ TEST_CASE("cas.basic") Instance1.WaitUntilReady(); std::atomic<uint64_t> RequestCount{0}; - std::atomic<uint64_t> BatchCounter{0}; zen::Stopwatch timer; std::mt19937_64 mt; - auto BaseUri = "http://localhost:{}/cas"_format(PortNumber); + auto BaseUri = fmt::format("http://localhost:{}/cas", PortNumber); cpr::Session cli; cli.SetUrl(cpr::Url{BaseUri}); @@ -946,7 +941,7 @@ TEST_CASE("cas.basic") for (int i = 0; i < IterationCount; ++i) { zen::ExtendableStringBuilder<128> Uri; - Uri << "http://localhost:{}/cas/"_format(PortNumber); + Uri << fmt::format("http://localhost:{}/cas/", PortNumber); ChunkHashes[i].ToHexString(Uri); auto res = cpr::Get(cpr::Url{Uri.c_str()}); @@ -980,7 +975,7 @@ TEST_CASE("project.basic") std::mt19937_64 mt; zen::StringBuilder<64> BaseUri; - BaseUri << "http://localhost:{}/prj/test"_format(PortNumber); + BaseUri << fmt::format("http://localhost:{}/prj/test", PortNumber); std::filesystem::path BinPath = zen::GetRunningExecutablePath(); std::filesystem::path RootPath = BinPath.parent_path().parent_path(); @@ -1148,13 +1143,13 @@ namespace utils { { return ZenConfig{.DataDir = TestEnv.CreateNewTestDir(), .Port = Port, - .BaseUri = "http://localhost:{}/z$"_format(Port), + .BaseUri = fmt::format("http://localhost:{}/z$", Port), .Args = std::move(Args)}; } static ZenConfig NewWithUpstream(uint16_t UpstreamPort) { - return New(13337, "--debug --upstream-thread-count=0 --upstream-zen-url=http://localhost:{}"_format(UpstreamPort)); + return New(13337, fmt::format("--debug --upstream-thread-count=0 --upstream-zen-url=http://localhost:{}", UpstreamPort)); } void Spawn(ZenServerInstance& Inst) @@ -1183,7 +1178,7 @@ TEST_CASE("zcache.basic") const uint16_t PortNumber = 13337; const int kIterationCount = 100; - const auto BaseUri = "http://localhost:{}/z$"_format(PortNumber); + const auto BaseUri = fmt::format("http://localhost:{}/z$", PortNumber); auto HashKey = [](int i) -> zen::IoHash { return zen::IoHash::HashBuffer(&i, sizeof i); }; @@ -1205,7 +1200,7 @@ TEST_CASE("zcache.basic") zen::IoHash Key = HashKey(i); - cpr::Response Result = cpr::Put(cpr::Url{"{}/{}/{}"_format(BaseUri, "test", Key)}, + cpr::Response Result = cpr::Put(cpr::Url{fmt::format("{}/{}/{}", BaseUri, "test", Key)}, cpr::Body{(const char*)MemOut.Data(), MemOut.Size()}, cpr::Header{{"Content-Type", "application/x-ue-cb"}}); @@ -1218,7 +1213,7 @@ TEST_CASE("zcache.basic") { zen::IoHash Key = zen::IoHash::HashBuffer(&i, sizeof i); - cpr::Response Result = cpr::Get(cpr::Url{"{}/{}/{}"_format(BaseUri, "test", Key)}); + cpr::Response Result = cpr::Get(cpr::Url{fmt::format("{}/{}/{}", BaseUri, "test", Key)}); CHECK(Result.status_code == 200); } @@ -1234,7 +1229,7 @@ TEST_CASE("zcache.basic") zen::IoHash Key = HashKey(442); - cpr::Response Result = cpr::Put(cpr::Url{"{}/{}/{}"_format(BaseUri, "te!st", Key)}, + cpr::Response Result = cpr::Put(cpr::Url{fmt::format("{}/{}/{}", BaseUri, "te!st", Key)}, cpr::Body{(const char*)MemOut.Data(), MemOut.Size()}, cpr::Header{{"Content-Type", "application/x-ue-cb"}}); @@ -1256,7 +1251,7 @@ TEST_CASE("zcache.basic") { zen::IoHash Key = HashKey(i); - cpr::Response Result = cpr::Get(cpr::Url{"{}/{}/{}"_format(BaseUri, "test", Key)}); + cpr::Response Result = cpr::Get(cpr::Url{fmt::format("{}/{}/{}", BaseUri, "test", Key)}); CHECK(Result.status_code == 200); } @@ -1297,7 +1292,7 @@ TEST_CASE("zcache.cbpackage") std::span<const zen::CbAttachment> LhsAttachments = Lhs.GetAttachments(); std::span<const zen::CbAttachment> RhsAttachments = Rhs.GetAttachments(); - if (LhsAttachments.size() != LhsAttachments.size()) + if (LhsAttachments.size() != RhsAttachments.size()) { return false; } @@ -1326,7 +1321,7 @@ TEST_CASE("zcache.cbpackage") { std::filesystem::path TestDir = TestEnv.CreateNewTestDir(); const uint16_t PortNumber = 13337; - const auto BaseUri = "http://localhost:{}/z$"_format(PortNumber); + const auto BaseUri = fmt::format("http://localhost:{}/z$", PortNumber); ZenServerInstance Instance1(TestEnv); Instance1.SetTestDir(TestDir); @@ -1340,7 +1335,7 @@ TEST_CASE("zcache.cbpackage") // PUT { zen::IoBuffer Body = SerializeToBuffer(ExpectedPackage); - cpr::Response Result = cpr::Put(cpr::Url{"{}/{}/{}"_format(BaseUri, Bucket, Key)}, + cpr::Response Result = cpr::Put(cpr::Url{fmt::format("{}/{}/{}", BaseUri, Bucket, Key)}, cpr::Body{(const char*)Body.Data(), Body.Size()}, cpr::Header{{"Content-Type", "application/x-ue-cbpkg"}}); CHECK(Result.status_code == 201); @@ -1349,7 +1344,7 @@ TEST_CASE("zcache.cbpackage") // GET { cpr::Response Result = - cpr::Get(cpr::Url{"{}/{}/{}"_format(BaseUri, Bucket, Key)}, cpr::Header{{"Accept", "application/x-ue-cbpkg"}}); + cpr::Get(cpr::Url{fmt::format("{}/{}/{}", BaseUri, Bucket, Key)}, cpr::Header{{"Accept", "application/x-ue-cbpkg"}}); CHECK(Result.status_code == 200); zen::IoBuffer Response(zen::IoBuffer::Wrap, Result.text.data(), Result.text.size()); @@ -1369,8 +1364,8 @@ TEST_CASE("zcache.cbpackage") const uint16_t LocalPortNumber = 13337; const uint16_t RemotePortNumber = 13338; - const auto LocalBaseUri = "http://localhost:{}/z$"_format(LocalPortNumber); - const auto RemoteBaseUri = "http://localhost:{}/z$"_format(RemotePortNumber); + const auto LocalBaseUri = fmt::format("http://localhost:{}/z$", LocalPortNumber); + const auto RemoteBaseUri = fmt::format("http://localhost:{}/z$", RemotePortNumber); ZenServerInstance RemoteInstance(TestEnv); RemoteInstance.SetTestDir(RemoteDataDir); @@ -1380,7 +1375,7 @@ TEST_CASE("zcache.cbpackage") ZenServerInstance LocalInstance(TestEnv); LocalInstance.SetTestDir(LocalDataDir); LocalInstance.SpawnServer(LocalPortNumber, - "--upstream-thread-count=0 --upstream-zen-url=http://localhost:{}"_format(RemotePortNumber)); + fmt::format("--upstream-thread-count=0 --upstream-zen-url=http://localhost:{}", RemotePortNumber)); LocalInstance.WaitUntilReady(); const std::string_view Bucket = "mosdef"sv; @@ -1390,7 +1385,7 @@ TEST_CASE("zcache.cbpackage") // Store the cache record package in the local instance { zen::IoBuffer Body = SerializeToBuffer(ExpectedPackage); - cpr::Response Result = cpr::Put(cpr::Url{"{}/{}/{}"_format(LocalBaseUri, Bucket, Key)}, + cpr::Response Result = cpr::Put(cpr::Url{fmt::format("{}/{}/{}", LocalBaseUri, Bucket, Key)}, cpr::Body{(const char*)Body.Data(), Body.Size()}, cpr::Header{{"Content-Type", "application/x-ue-cbpkg"}}); @@ -1400,7 +1395,7 @@ TEST_CASE("zcache.cbpackage") // The cache record can be retrieved as a package from the local instance { cpr::Response Result = - cpr::Get(cpr::Url{"{}/{}/{}"_format(LocalBaseUri, Bucket, Key)}, cpr::Header{{"Accept", "application/x-ue-cbpkg"}}); + cpr::Get(cpr::Url{fmt::format("{}/{}/{}", LocalBaseUri, Bucket, Key)}, cpr::Header{{"Accept", "application/x-ue-cbpkg"}}); CHECK(Result.status_code == 200); zen::IoBuffer Body(zen::IoBuffer::Wrap, Result.text.data(), Result.text.size()); @@ -1413,7 +1408,7 @@ TEST_CASE("zcache.cbpackage") // The cache record can be retrieved as a package from the remote instance { cpr::Response Result = - cpr::Get(cpr::Url{"{}/{}/{}"_format(RemoteBaseUri, Bucket, Key)}, cpr::Header{{"Accept", "application/x-ue-cbpkg"}}); + cpr::Get(cpr::Url{fmt::format("{}/{}/{}", RemoteBaseUri, Bucket, Key)}, cpr::Header{{"Accept", "application/x-ue-cbpkg"}}); CHECK(Result.status_code == 200); zen::IoBuffer Body(zen::IoBuffer::Wrap, Result.text.data(), Result.text.size()); @@ -1432,8 +1427,8 @@ TEST_CASE("zcache.cbpackage") const uint16_t LocalPortNumber = 13337; const uint16_t RemotePortNumber = 13338; - const auto LocalBaseUri = "http://localhost:{}/z$"_format(LocalPortNumber); - const auto RemoteBaseUri = "http://localhost:{}/z$"_format(RemotePortNumber); + const auto LocalBaseUri = fmt::format("http://localhost:{}/z$", LocalPortNumber); + const auto RemoteBaseUri = fmt::format("http://localhost:{}/z$", RemotePortNumber); ZenServerInstance RemoteInstance(TestEnv); RemoteInstance.SetTestDir(RemoteDataDir); @@ -1443,7 +1438,7 @@ TEST_CASE("zcache.cbpackage") ZenServerInstance LocalInstance(TestEnv); LocalInstance.SetTestDir(LocalDataDir); LocalInstance.SpawnServer(LocalPortNumber, - "--upstream-thread-count=0 --upstream-zen-url=http://localhost:{}"_format(RemotePortNumber)); + fmt::format("--upstream-thread-count=0 --upstream-zen-url=http://localhost:{}", RemotePortNumber)); LocalInstance.WaitUntilReady(); const std::string_view Bucket = "mosdef"sv; @@ -1453,7 +1448,7 @@ TEST_CASE("zcache.cbpackage") // Store the cache record package in upstream cache { zen::IoBuffer Body = SerializeToBuffer(ExpectedPackage); - cpr::Response Result = cpr::Put(cpr::Url{"{}/{}/{}"_format(RemoteBaseUri, Bucket, Key)}, + cpr::Response Result = cpr::Put(cpr::Url{fmt::format("{}/{}/{}", RemoteBaseUri, Bucket, Key)}, cpr::Body{(const char*)Body.Data(), Body.Size()}, cpr::Header{{"Content-Type", "application/x-ue-cbpkg"}}); @@ -1463,7 +1458,7 @@ TEST_CASE("zcache.cbpackage") // The cache record can be retrieved as a package from the local cache { cpr::Response Result = - cpr::Get(cpr::Url{"{}/{}/{}"_format(LocalBaseUri, Bucket, Key)}, cpr::Header{{"Accept", "application/x-ue-cbpkg"}}); + cpr::Get(cpr::Url{fmt::format("{}/{}/{}", LocalBaseUri, Bucket, Key)}, cpr::Header{{"Accept", "application/x-ue-cbpkg"}}); CHECK(Result.status_code == 200); zen::IoBuffer Body(zen::IoBuffer::Wrap, Result.text.data(), Result.text.size()); @@ -1534,20 +1529,20 @@ TEST_CASE("zcache.policy") // Store binary cache value upstream { - cpr::Response Result = cpr::Put(cpr::Url{"{}/{}/{}"_format(UpstreamCfg.BaseUri, Bucket, Key)}, + cpr::Response Result = cpr::Put(cpr::Url{fmt::format("{}/{}/{}", UpstreamCfg.BaseUri, Bucket, Key)}, cpr::Body{(const char*)BinaryValue.GetData(), BinaryValue.GetSize()}, cpr::Header{{"Content-Type", "application/octet-stream"}}); CHECK(Result.status_code == 201); } { - cpr::Response Result = cpr::Get(cpr::Url{"{}/{}/{}?query=local"_format(LocalCfg.BaseUri, Bucket, Key)}, + cpr::Response Result = cpr::Get(cpr::Url{fmt::format("{}/{}/{}?query=local", LocalCfg.BaseUri, Bucket, Key)}, cpr::Header{{"Accept", "application/octet-stream"}}); CHECK(Result.status_code == 404); } { - cpr::Response Result = cpr::Get(cpr::Url{"{}/{}/{}?query=local,remote"_format(LocalCfg.BaseUri, Bucket, Key)}, + cpr::Response Result = cpr::Get(cpr::Url{fmt::format("{}/{}/{}?query=local,remote", LocalCfg.BaseUri, Bucket, Key)}, cpr::Header{{"Accept", "application/octet-stream"}}); CHECK(Result.status_code == 200); } @@ -1569,21 +1564,21 @@ TEST_CASE("zcache.policy") // Store binary cache value locally { - cpr::Response Result = cpr::Put(cpr::Url{"{}/{}/{}?store=local"_format(LocalCfg.BaseUri, Bucket, Key)}, + cpr::Response Result = cpr::Put(cpr::Url{fmt::format("{}/{}/{}?store=local", LocalCfg.BaseUri, Bucket, Key)}, cpr::Body{(const char*)BinaryValue.GetData(), BinaryValue.GetSize()}, cpr::Header{{"Content-Type", "application/octet-stream"}}); CHECK(Result.status_code == 201); } { - cpr::Response Result = cpr::Get(cpr::Url{"{}/{}/{}"_format(UpstreamCfg.BaseUri, Bucket, Key)}, + cpr::Response Result = cpr::Get(cpr::Url{fmt::format("{}/{}/{}", UpstreamCfg.BaseUri, Bucket, Key)}, cpr::Header{{"Accept", "application/octet-stream"}}); CHECK(Result.status_code == 404); } { cpr::Response Result = - cpr::Get(cpr::Url{"{}/{}/{}"_format(LocalCfg.BaseUri, Bucket, Key)}, cpr::Header{{"Accept", "application/octet-stream"}}); + cpr::Get(cpr::Url{fmt::format("{}/{}/{}", LocalCfg.BaseUri, Bucket, Key)}, cpr::Header{{"Accept", "application/octet-stream"}}); CHECK(Result.status_code == 200); } } @@ -1604,21 +1599,21 @@ TEST_CASE("zcache.policy") // Store binary cache value locally and upstream { - cpr::Response Result = cpr::Put(cpr::Url{"{}/{}/{}?store=local,remote"_format(LocalCfg.BaseUri, Bucket, Key)}, + cpr::Response Result = cpr::Put(cpr::Url{fmt::format("{}/{}/{}?store=local,remote", LocalCfg.BaseUri, Bucket, Key)}, cpr::Body{(const char*)BinaryValue.GetData(), BinaryValue.GetSize()}, cpr::Header{{"Content-Type", "application/octet-stream"}}); CHECK(Result.status_code == 201); } { - cpr::Response Result = cpr::Get(cpr::Url{"{}/{}/{}"_format(UpstreamCfg.BaseUri, Bucket, Key)}, + cpr::Response Result = cpr::Get(cpr::Url{fmt::format("{}/{}/{}", UpstreamCfg.BaseUri, Bucket, Key)}, cpr::Header{{"Accept", "application/octet-stream"}}); CHECK(Result.status_code == 200); } { cpr::Response Result = - cpr::Get(cpr::Url{"{}/{}/{}"_format(LocalCfg.BaseUri, Bucket, Key)}, cpr::Header{{"Accept", "application/octet-stream"}}); + cpr::Get(cpr::Url{fmt::format("{}/{}/{}", LocalCfg.BaseUri, Bucket, Key)}, cpr::Header{{"Accept", "application/octet-stream"}}); CHECK(Result.status_code == 200); } } @@ -1641,20 +1636,20 @@ TEST_CASE("zcache.policy") // Store package upstream { - cpr::Response Result = cpr::Put(cpr::Url{"{}/{}/{}"_format(UpstreamCfg.BaseUri, Bucket, Key)}, + cpr::Response Result = cpr::Put(cpr::Url{fmt::format("{}/{}/{}", UpstreamCfg.BaseUri, Bucket, Key)}, cpr::Body{(const char*)Buf.GetData(), Buf.GetSize()}, cpr::Header{{"Content-Type", "application/x-ue-cbpkg"}}); CHECK(Result.status_code == 201); } { - cpr::Response Result = cpr::Get(cpr::Url{"{}/{}/{}?query=local"_format(LocalCfg.BaseUri, Bucket, Key)}, + cpr::Response Result = cpr::Get(cpr::Url{fmt::format("{}/{}/{}?query=local", LocalCfg.BaseUri, Bucket, Key)}, cpr::Header{{"Accept", "application/x-ue-cbpkg"}}); CHECK(Result.status_code == 404); } { - cpr::Response Result = cpr::Get(cpr::Url{"{}/{}/{}?query=local,remote"_format(LocalCfg.BaseUri, Bucket, Key)}, + cpr::Response Result = cpr::Get(cpr::Url{fmt::format("{}/{}/{}?query=local,remote", LocalCfg.BaseUri, Bucket, Key)}, cpr::Header{{"Accept", "application/x-ue-cbpkg"}}); CHECK(Result.status_code == 200); } @@ -1678,7 +1673,7 @@ TEST_CASE("zcache.policy") // Store packge locally { - cpr::Response Result = cpr::Put(cpr::Url{"{}/{}/{}?store=local"_format(LocalCfg.BaseUri, Bucket, Key)}, + cpr::Response Result = cpr::Put(cpr::Url{fmt::format("{}/{}/{}?store=local", LocalCfg.BaseUri, Bucket, Key)}, cpr::Body{(const char*)Buf.GetData(), Buf.GetSize()}, cpr::Header{{"Content-Type", "application/x-ue-cbpkg"}}); CHECK(Result.status_code == 201); @@ -1686,13 +1681,13 @@ TEST_CASE("zcache.policy") { cpr::Response Result = - cpr::Get(cpr::Url{"{}/{}/{}"_format(UpstreamCfg.BaseUri, Bucket, Key)}, cpr::Header{{"Accept", "application/x-ue-cbpkg"}}); + cpr::Get(cpr::Url{fmt::format("{}/{}/{}", UpstreamCfg.BaseUri, Bucket, Key)}, cpr::Header{{"Accept", "application/x-ue-cbpkg"}}); CHECK(Result.status_code == 404); } { cpr::Response Result = - cpr::Get(cpr::Url{"{}/{}/{}"_format(LocalCfg.BaseUri, Bucket, Key)}, cpr::Header{{"Accept", "application/x-ue-cbpkg"}}); + cpr::Get(cpr::Url{fmt::format("{}/{}/{}", LocalCfg.BaseUri, Bucket, Key)}, cpr::Header{{"Accept", "application/x-ue-cbpkg"}}); CHECK(Result.status_code == 200); } } @@ -1715,7 +1710,7 @@ TEST_CASE("zcache.policy") // Store package locally and upstream { - cpr::Response Result = cpr::Put(cpr::Url{"{}/{}/{}?store=local,remote"_format(LocalCfg.BaseUri, Bucket, Key)}, + cpr::Response Result = cpr::Put(cpr::Url{fmt::format("{}/{}/{}?store=local,remote", LocalCfg.BaseUri, Bucket, Key)}, cpr::Body{(const char*)Buf.GetData(), Buf.GetSize()}, cpr::Header{{"Content-Type", "application/x-ue-cbpkg"}}); CHECK(Result.status_code == 201); @@ -1723,13 +1718,13 @@ TEST_CASE("zcache.policy") { cpr::Response Result = - cpr::Get(cpr::Url{"{}/{}/{}"_format(UpstreamCfg.BaseUri, Bucket, Key)}, cpr::Header{{"Accept", "application/x-ue-cbpkg"}}); + cpr::Get(cpr::Url{fmt::format("{}/{}/{}", UpstreamCfg.BaseUri, Bucket, Key)}, cpr::Header{{"Accept", "application/x-ue-cbpkg"}}); CHECK(Result.status_code == 200); } { cpr::Response Result = - cpr::Get(cpr::Url{"{}/{}/{}"_format(LocalCfg.BaseUri, Bucket, Key)}, cpr::Header{{"Accept", "application/x-ue-cbpkg"}}); + cpr::Get(cpr::Url{fmt::format("{}/{}/{}", LocalCfg.BaseUri, Bucket, Key)}, cpr::Header{{"Accept", "application/x-ue-cbpkg"}}); CHECK(Result.status_code == 200); } } @@ -1751,14 +1746,14 @@ TEST_CASE("zcache.policy") auto Buf = ToBuffer(Package); CHECK(Package.GetAttachments().size() != 0); - cpr::Response Result = cpr::Put(cpr::Url{"{}/{}/{}"_format(LocalCfg.BaseUri, Bucket, Key)}, + cpr::Response Result = cpr::Put(cpr::Url{fmt::format("{}/{}/{}", LocalCfg.BaseUri, Bucket, Key)}, cpr::Body{(const char*)Buf.GetData(), Buf.GetSize()}, cpr::Header{{"Content-Type", "application/x-ue-cbpkg"}}); CHECK(Result.status_code == 201); } { - cpr::Response Result = cpr::Get(cpr::Url{"{}/{}/{}?skip=attachments"_format(LocalCfg.BaseUri, Bucket, Key)}, + cpr::Response Result = cpr::Get(cpr::Url{fmt::format("{}/{}/{}?skip=attachments", LocalCfg.BaseUri, Bucket, Key)}, cpr::Header{{"Accept", "application/x-ue-cbpkg"}}); CHECK(Result.status_code == 200); @@ -1781,7 +1776,7 @@ TEST_CASE("zcache.policy") { cpr::Response Result = - cpr::Get(cpr::Url{"{}/{}/{}"_format(LocalCfg.BaseUri, Bucket, Key)}, cpr::Header{{"Accept", "application/x-ue-cbpkg"}}); + cpr::Get(cpr::Url{fmt::format("{}/{}/{}", LocalCfg.BaseUri, Bucket, Key)}, cpr::Header{{"Accept", "application/x-ue-cbpkg"}}); CHECK(Result.status_code == 200); zen::IoBuffer Body(zen::IoBuffer::Wrap, Result.text.data(), Result.text.size()); @@ -1814,14 +1809,14 @@ TEST_CASE("zcache.policy") auto Buf = ToBuffer(Package); CHECK(Package.GetAttachments().size() != 0); - cpr::Response Result = cpr::Put(cpr::Url{"{}/{}/{}"_format(UpstreamCfg.BaseUri, Bucket, Key)}, + cpr::Response Result = cpr::Put(cpr::Url{fmt::format("{}/{}/{}", UpstreamCfg.BaseUri, Bucket, Key)}, cpr::Body{(const char*)Buf.GetData(), Buf.GetSize()}, cpr::Header{{"Content-Type", "application/x-ue-cbpkg"}}); CHECK(Result.status_code == 201); } { - cpr::Response Result = cpr::Get(cpr::Url{"{}/{}/{}?skip=attachments"_format(LocalCfg.BaseUri, Bucket, Key)}, + cpr::Response Result = cpr::Get(cpr::Url{fmt::format("{}/{}/{}?skip=attachments", LocalCfg.BaseUri, Bucket, Key)}, cpr::Header{{"Accept", "application/x-ue-cbpkg"}}); CHECK(Result.status_code == 200); @@ -1844,7 +1839,7 @@ TEST_CASE("zcache.policy") { cpr::Response Result = - cpr::Get(cpr::Url{"{}/{}/{}"_format(LocalCfg.BaseUri, Bucket, Key)}, cpr::Header{{"Accept", "application/x-ue-cbpkg"}}); + cpr::Get(cpr::Url{fmt::format("{}/{}/{}", LocalCfg.BaseUri, Bucket, Key)}, cpr::Header{{"Accept", "application/x-ue-cbpkg"}}); CHECK(Result.status_code == 200); zen::IoBuffer Body(zen::IoBuffer::Wrap, Result.text.data(), Result.text.size()); @@ -1872,7 +1867,7 @@ TEST_CASE("zcache.policy") // Store package { - cpr::Response Result = cpr::Put(cpr::Url{"{}/{}/{}"_format(Cfg.BaseUri, Bucket, Key)}, + cpr::Response Result = cpr::Put(cpr::Url{fmt::format("{}/{}/{}", Cfg.BaseUri, Bucket, Key)}, cpr::Body{(const char*)Buf.GetData(), Buf.GetSize()}, cpr::Header{{"Content-Type", "application/x-ue-cbpkg"}}); CHECK(Result.status_code == 201); @@ -1880,7 +1875,7 @@ TEST_CASE("zcache.policy") // Get package { - cpr::Response Result = cpr::Get(cpr::Url{"{}/{}/{}?skip=data"_format(Cfg.BaseUri, Bucket, Key)}, + cpr::Response Result = cpr::Get(cpr::Url{fmt::format("{}/{}/{}?skip=data", Cfg.BaseUri, Bucket, Key)}, cpr::Header{{"Accept", "application/x-ue-cbpkg"}}); CHECK(IsHttpSuccessCode(Result.status_code)); CHECK(Result.text.size() == 0); @@ -1888,7 +1883,7 @@ TEST_CASE("zcache.policy") // Get record { - cpr::Response Result = cpr::Get(cpr::Url{"{}/{}/{}?skip=data"_format(Cfg.BaseUri, Bucket, Key)}, + cpr::Response Result = cpr::Get(cpr::Url{fmt::format("{}/{}/{}?skip=data", Cfg.BaseUri, Bucket, Key)}, cpr::Header{{"Accept", "application/x-ue-cbobject"}}); CHECK(IsHttpSuccessCode(Result.status_code)); CHECK(Result.text.size() == 0); @@ -1896,7 +1891,7 @@ TEST_CASE("zcache.policy") // Get payload { - cpr::Response Result = cpr::Get(cpr::Url{"{}/{}/{}/{}?skip=data"_format(Cfg.BaseUri, Bucket, Key, PayloadId)}, + cpr::Response Result = cpr::Get(cpr::Url{fmt::format("{}/{}/{}/{}?skip=data", Cfg.BaseUri, Bucket, Key, PayloadId)}, cpr::Header{{"Accept", "application/x-ue-comp"}}); CHECK(IsHttpSuccessCode(Result.status_code)); CHECK(Result.text.size() == 0); @@ -1916,7 +1911,7 @@ TEST_CASE("zcache.policy") // Store binary cache value { - cpr::Response Result = cpr::Put(cpr::Url{"{}/{}/{}"_format(Cfg.BaseUri, Bucket, Key)}, + cpr::Response Result = cpr::Put(cpr::Url{fmt::format("{}/{}/{}", Cfg.BaseUri, Bucket, Key)}, cpr::Body{(const char*)BinaryValue.GetData(), BinaryValue.GetSize()}, cpr::Header{{"Content-Type", "application/octet-stream"}}); CHECK(Result.status_code == 201); @@ -1924,7 +1919,7 @@ TEST_CASE("zcache.policy") // Get package { - cpr::Response Result = cpr::Get(cpr::Url{"{}/{}/{}?skip=data"_format(Cfg.BaseUri, Bucket, Key)}, + cpr::Response Result = cpr::Get(cpr::Url{fmt::format("{}/{}/{}?skip=data", Cfg.BaseUri, Bucket, Key)}, cpr::Header{{"Accept", "application/octet-stream"}}); CHECK(IsHttpSuccessCode(Result.status_code)); CHECK(Result.text.size() == 0); @@ -1981,7 +1976,7 @@ TEST_CASE("zcache.rpc") IoBuffer Payload = ToIoBuffer(CacheRecord); - cpr::Response Result = cpr::Put(cpr::Url{"{}/{}/{}{}"_format(BaseUri, CacheKey.Bucket, CacheKey.Hash, Query)}, + cpr::Response Result = cpr::Put(cpr::Url{fmt::format("{}/{}/{}{}", BaseUri, CacheKey.Bucket, CacheKey.Hash, Query)}, cpr::Body{(const char*)Payload.Data(), Payload.Size()}, cpr::Header{{"Content-Type", "application/x-ue-cbpkg"}}); @@ -2025,7 +2020,7 @@ TEST_CASE("zcache.rpc") BinaryWriter Body; Request.Save(Body); - cpr::Response Result = cpr::Post(cpr::Url{"{}/$rpc"_format(BaseUri)}, + cpr::Response Result = cpr::Post(cpr::Url{fmt::format("{}/$rpc", BaseUri)}, cpr::Header{{"Content-Type", "application/x-ue-cb"}, {"Accept", "application/x-ue-cbpkg"}}, cpr::Body{(const char*)Body.GetData(), Body.GetSize()}); @@ -2063,7 +2058,7 @@ TEST_CASE("zcache.rpc") { std::filesystem::path TestDir = TestEnv.CreateNewTestDir(); const uint16_t PortNumber = 13337; - const auto BaseUri = "http://localhost:{}/z$"_format(PortNumber); + const auto BaseUri = fmt::format("http://localhost:{}/z$", PortNumber); ZenServerInstance Inst(TestEnv); Inst.SetTestDir(TestDir); @@ -2095,7 +2090,7 @@ TEST_CASE("zcache.rpc") { std::filesystem::path TestDir = TestEnv.CreateNewTestDir(); const uint16_t PortNumber = 13337; - const auto BaseUri = "http://localhost:{}/z$"_format(PortNumber); + const auto BaseUri = fmt::format("http://localhost:{}/z$", PortNumber); ZenServerInstance Inst(TestEnv); Inst.SetTestDir(TestDir); @@ -2143,7 +2138,7 @@ TEST_CASE("zcache.rpc") { std::filesystem::path TestDir = TestEnv.CreateNewTestDir(); const uint16_t PortNumber = 13337; - const auto BaseUri = "http://localhost:{}/z$"_format(PortNumber); + const auto BaseUri = fmt::format("http://localhost:{}/z$", PortNumber); ZenServerInstance Inst(TestEnv); Inst.SetTestDir(TestDir); @@ -2261,7 +2256,7 @@ struct RemoteExecutionRequest void Prep() { - cpr::Response Response = cpr::Post(cpr::Url("{}/prep"_format(m_BaseUri)), cpr::Body((const char*)m_MemOut.Data(), m_MemOut.Size())); + cpr::Response Response = cpr::Post(cpr::Url(fmt::format("{}/prep", m_BaseUri)), cpr::Body((const char*)m_MemOut.Data(), m_MemOut.Size())); if (Response.status_code < 300) { @@ -2355,8 +2350,8 @@ private: std::string m_HostName; int m_PortNumber; std::filesystem::path m_TreePath; - const std::string m_BaseUri = "http://{}:{}/exec/jobs"_format(m_HostName, m_PortNumber); - const std::string m_CasUri = "http://{}:{}/cas"_format(m_HostName, m_PortNumber); + const std::string m_BaseUri = fmt::format("http://{}:{}/exec/jobs", m_HostName, m_PortNumber); + const std::string m_CasUri = fmt::format("http://{}:{}/cas", m_HostName, m_PortNumber); Visitor m_Visit{m_TreePath}; zen::BinaryWriter m_MemOut; }; @@ -2486,17 +2481,17 @@ TEST_CASE("http.basics") const std::string BaseUri = Instance.GetBaseUri(); { - cpr::Response r = cpr::Get(cpr::Url{"{}/testing/hello"_format(BaseUri)}); + cpr::Response r = cpr::Get(cpr::Url{fmt::format("{}/testing/hello", BaseUri)}); CHECK(IsHttpSuccessCode(r.status_code)); } { - cpr::Response r = cpr::Post(cpr::Url{"{}/testing/hello"_format(BaseUri)}); + cpr::Response r = cpr::Post(cpr::Url{fmt::format("{}/testing/hello", BaseUri)}); CHECK_EQ(r.status_code, 404); } { - cpr::Response r = cpr::Post(cpr::Url{"{}/testing/echo"_format(BaseUri)}, cpr::Body{"yoyoyoyo"}); + cpr::Response r = cpr::Post(cpr::Url{fmt::format("{}/testing/echo", BaseUri)}, cpr::Body{"yoyoyoyo"}); CHECK_EQ(r.status_code, 200); CHECK_EQ(r.text, "yoyoyoyo"); } |