summaryrefslogtreecommitdiff
path: root/test/util/http_timeout.test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/util/http_timeout.test.cpp')
-rw-r--r--test/util/http_timeout.test.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/test/util/http_timeout.test.cpp b/test/util/http_timeout.test.cpp
index e99c703159..c9373d955d 100644
--- a/test/util/http_timeout.test.cpp
+++ b/test/util/http_timeout.test.cpp
@@ -2,22 +2,25 @@
#include <mbgl/util/logging.hpp>
#include <mbgl/util/http_timeout.hpp>
-#include <regex>
-#include <iostream>
using namespace mbgl;
using namespace mbgl::http;
TEST(HttpRetry, OtherError) {
- //Non-retryable
+ // Non-retryable
ASSERT_EQ(Duration::max(), errorRetryTimeout(Response::Error::Reason::Other, 1));
}
+TEST(HttpRetry, NotFound) {
+ // Non-retryable
+ ASSERT_EQ(Duration::max(), errorRetryTimeout(Response::Error::Reason::NotFound, 1));
+}
+
TEST(HttpRetry, ServerError) {
// 1-3 failures -> 1 sec
ASSERT_EQ(Seconds(1), errorRetryTimeout(Response::Error::Reason::Server, 1));
ASSERT_EQ(Seconds(1), errorRetryTimeout(Response::Error::Reason::Server, 3));
-
+
// After 3, exponential backoff
ASSERT_EQ(Seconds(2), errorRetryTimeout(Response::Error::Reason::Server, 4));
ASSERT_EQ(Seconds(1u << 31), errorRetryTimeout(Response::Error::Reason::Server, 50));
@@ -32,8 +35,8 @@ TEST(HttpRetry, ConnectionError) {
TEST(HttpRetry, RateLimit) {
// Pre-set value from header
ASSERT_EQ(Seconds(1), errorRetryTimeout(Response::Error::Reason::Server, 1, { util::now() + Seconds(1) }));
-
- //Default
+
+ // Default
ASSERT_EQ(Seconds(5), errorRetryTimeout(Response::Error::Reason::RateLimit, 1, {}));
}