Skip to content

Commit

Permalink
set a timeout for the http-operation (in unittests)
Browse files Browse the repository at this point in the history
  • Loading branch information
ptahmose committed Nov 2, 2023
1 parent 359f5f1 commit e9408de
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Src/libCZI_UnitTests/test_curlhttpstream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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);

Expand Down

0 comments on commit e9408de

Please sign in to comment.