From e9408de1a3882436630e13abd8bf5d4d21e4c6e6 Mon Sep 17 00:00:00 2001 From: ptahmose Date: Thu, 2 Nov 2023 11:48:49 +0100 Subject: [PATCH] set a timeout for the http-operation (in unittests) --- Src/libCZI_UnitTests/test_curlhttpstream.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Src/libCZI_UnitTests/test_curlhttpstream.cpp b/Src/libCZI_UnitTests/test_curlhttpstream.cpp index ad92e274..11ada559 100644 --- a/Src/libCZI_UnitTests/test_curlhttpstream.cpp +++ b/Src/libCZI_UnitTests/test_curlhttpstream.cpp @@ -13,6 +13,10 @@ TEST(CurlHttpInputStream, SimpleReadFromHttps) StreamsFactory::CreateStreamInfo create_info; create_info.class_name = "curl_http_inputstream"; + + // set a five-seconds time-out (for the whole operation) + create_info.property_bag = { {StreamsFactory::StreamProperties::kCurlHttp_Timeout,StreamsFactory::Property(5)} }; + const auto stream = StreamsFactory::CreateStream(create_info, kUrl); if (!stream) @@ -46,6 +50,10 @@ TEST(CurlHttpInputStream, OpenAndReadCziFromUrl) StreamsFactory::CreateStreamInfo create_info; create_info.class_name = "curl_http_inputstream"; + + // set a five-seconds time-out (for the whole operation) + create_info.property_bag = { {StreamsFactory::StreamProperties::kCurlHttp_Timeout,StreamsFactory::Property(5)} }; + const auto stream = StreamsFactory::CreateStream(create_info, kUrl); if (!stream) @@ -62,7 +70,7 @@ TEST(CurlHttpInputStream, OpenAndReadCziFromUrl) { GTEST_SKIP() << "Exception: " << e.what() << "--> skipping this test as inconclusive, assuming network issues"; } - + const auto statistics = czi_reader->GetStatistics(); EXPECT_EQ(statistics.subBlockCount, 2);