(
request,
)
| 137 | |
| 138 | @pytest.fixture() |
| 139 | def r_multi_db( |
| 140 | request, |
| 141 | ) -> tuple[MultiDBClient, CheckActiveDatabaseChangedListener, dict]: |
| 142 | client_class = request.param.get("client_class", Redis) |
| 143 | |
| 144 | if client_class == Redis: |
| 145 | endpoint_config = get_endpoints_config("re-active-active") |
| 146 | else: |
| 147 | endpoint_config = get_endpoints_config("re-active-active-oss-cluster") |
| 148 | |
| 149 | username = endpoint_config.get("username", None) |
| 150 | password = endpoint_config.get("password", None) |
| 151 | min_num_failures = request.param.get("min_num_failures", DEFAULT_MIN_NUM_FAILURES) |
| 152 | command_retry = request.param.get( |
| 153 | "command_retry", Retry(ExponentialBackoff(cap=0.1, base=0.01), retries=10) |
| 154 | ) |
| 155 | |
| 156 | # Retry configuration different for health checks as initial health check require more time in case |
| 157 | # if infrastructure wasn't restored from the previous test. |
| 158 | health_check_interval = request.param.get( |
| 159 | "health_check_interval", DEFAULT_HEALTH_CHECK_INTERVAL |
| 160 | ) |
| 161 | health_check_delay = request.param.get( |
| 162 | "health_check_delay", DEFAULT_HEALTH_CHECK_DELAY |
| 163 | ) |
| 164 | event_dispatcher = EventDispatcher() |
| 165 | listener = CheckActiveDatabaseChangedListener() |
| 166 | event_dispatcher.register_listeners( |
| 167 | { |
| 168 | ActiveDatabaseChanged: [listener], |
| 169 | } |
| 170 | ) |
| 171 | db_configs = [] |
| 172 | |
| 173 | db_config = DatabaseConfig( |
| 174 | weight=1.0, |
| 175 | from_url=endpoint_config["endpoints"][0], |
| 176 | client_kwargs={ |
| 177 | "username": username, |
| 178 | "password": password, |
| 179 | "decode_responses": True, |
| 180 | }, |
| 181 | health_check_url=extract_cluster_fqdn(endpoint_config["endpoints"][0]), |
| 182 | ) |
| 183 | db_configs.append(db_config) |
| 184 | |
| 185 | db_config1 = DatabaseConfig( |
| 186 | weight=0.9, |
| 187 | from_url=endpoint_config["endpoints"][1], |
| 188 | client_kwargs={ |
| 189 | "username": username, |
| 190 | "password": password, |
| 191 | "decode_responses": True, |
| 192 | }, |
| 193 | health_check_url=extract_cluster_fqdn(endpoint_config["endpoints"][1]), |
| 194 | ) |
| 195 | db_configs.append(db_config1) |
| 196 |
nothing calls this directly
no test coverage detected