From 8dd8b1905bec171995f1eab331e69969bae444df Mon Sep 17 00:00:00 2001 From: Dean Lee Date: Tue, 4 Jan 2022 12:10:57 +0800 Subject: [PATCH] replay tests: retry on network failure (#23383) --- selfdrive/ui/replay/tests/test_replay.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/selfdrive/ui/replay/tests/test_replay.cc b/selfdrive/ui/replay/tests/test_replay.cc index 5b9b7cdeb7db72..6063dfe7d57fec 100644 --- a/selfdrive/ui/replay/tests/test_replay.cc +++ b/selfdrive/ui/replay/tests/test_replay.cc @@ -17,11 +17,17 @@ TEST_CASE("httpMultiPartDownload") { const size_t chunk_size = 5 * 1024 * 1024; std::string content; SECTION("download to file") { - REQUIRE(httpDownload(TEST_RLOG_URL, filename, chunk_size)); + bool ret = false; + for (int i = 0; i < 3 && !ret; ++i) { + ret = httpDownload(TEST_RLOG_URL, filename, chunk_size); + } + REQUIRE(ret); content = util::read_file(filename); } SECTION("download to buffer") { - content = httpGet(TEST_RLOG_URL, chunk_size); + for (int i = 0; i < 3 && content.empty(); ++i) { + content = httpGet(TEST_RLOG_URL, chunk_size); + } REQUIRE(!content.empty()); } REQUIRE(content.size() == 9112651);