4
4
5
5
from redis .backoff import ExponentialBackoff
6
6
from redis .multidb .database import Database
7
- from redis .multidb .healthcheck import EchoHealthCheck
8
7
from redis .http .http_client import HttpError
9
8
from redis .multidb .healthcheck import EchoHealthCheck , LagAwareHealthCheck
10
9
from redis .multidb .circuit import State as CBState
@@ -74,7 +73,7 @@ def test_database_is_healthy_when_bdb_matches_by_dns_name(self, mock_client, moc
74
73
75
74
hc = LagAwareHealthCheck (
76
75
retry = Retry (backoff = ExponentialBackoff (cap = 1.0 ), retries = 3 ),
77
- rest_api_port = 1234 ,
76
+ rest_api_port = 1234 , lag_aware_tolerance = 150
78
77
)
79
78
# Inject our mocked http client
80
79
hc ._http_client = mock_http
@@ -89,7 +88,7 @@ def test_database_is_healthy_when_bdb_matches_by_dns_name(self, mock_client, moc
89
88
first_call = mock_http .get .call_args_list [0 ]
90
89
second_call = mock_http .get .call_args_list [1 ]
91
90
assert first_call .args [0 ] == "/v1/bdbs"
92
- assert second_call .args [0 ] == "/v1/local/bdbs/bdb-1/endpoint/availability"
91
+ assert second_call .args [0 ] == "/v1/local/bdbs/bdb-1/endpoint/availability?extend_check=lag&availability_lag_tolerance_ms=150 "
93
92
assert second_call .kwargs .get ("expect_json" ) is False
94
93
95
94
def test_database_is_healthy_when_bdb_matches_by_addr (self , mock_client , mock_cb ):
@@ -121,7 +120,7 @@ def test_database_is_healthy_when_bdb_matches_by_addr(self, mock_client, mock_cb
121
120
122
121
assert hc .check_health (db ) is True
123
122
assert mock_http .get .call_count == 2
124
- assert mock_http .get .call_args_list [1 ].args [0 ] == "/v1/local/bdbs/bdb-42/endpoint/availability"
123
+ assert mock_http .get .call_args_list [1 ].args [0 ] == "/v1/local/bdbs/bdb-42/endpoint/availability?extend_check=lag&availability_lag_tolerance_ms=100 "
125
124
126
125
def test_raises_value_error_when_no_matching_bdb (self , mock_client , mock_cb ):
127
126
"""
0 commit comments