Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 9 additions & 13 deletions test/asynchronous/test_srv_polling.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,23 +273,19 @@ async def _test_recover_from_initial(self, initial_callback):
def final_callback():
return response_final

with SrvPollingKnobs(
ttl_time=WAIT_TIME,
min_srv_rescan_interval=WAIT_TIME,
nodelist_callback=initial_callback,
count_resolver_calls=True,
):
# Keep the short rescan interval and TTL patched for the whole test so a
# poll racing the swap between callbacks can't pick up the real DNS TTL.
with SrvPollingKnobs(ttl_time=WAIT_TIME, min_srv_rescan_interval=WAIT_TIME):
# Client uses unpatched method to get initial nodelist
client = self.simple_client(self.CONNECTION_STRING)
await client.aconnect()
# Invalid DNS resolver response should not change nodelist.
await self.assert_nodelist_nochange(self.BASE_SRV_RESPONSE, client)
with SrvPollingKnobs(nodelist_callback=initial_callback, count_resolver_calls=True):
# Invalid DNS resolver response should not change nodelist.
await self.assert_nodelist_nochange(self.BASE_SRV_RESPONSE, client)

with SrvPollingKnobs(
ttl_time=WAIT_TIME, min_srv_rescan_interval=WAIT_TIME, nodelist_callback=final_callback
):
# Nodelist should reflect new valid DNS resolver response.
await self.assert_nodelist_change(response_final, client)
with SrvPollingKnobs(nodelist_callback=final_callback):
# Nodelist should reflect new valid DNS resolver response.
await self.assert_nodelist_change(response_final, client)

async def test_recover_from_initially_empty_seedlist(self):
def empty_seedlist():
Expand Down
22 changes: 9 additions & 13 deletions test/test_srv_polling.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,23 +273,19 @@ def _test_recover_from_initial(self, initial_callback):
def final_callback():
return response_final

with SrvPollingKnobs(
ttl_time=WAIT_TIME,
min_srv_rescan_interval=WAIT_TIME,
nodelist_callback=initial_callback,
count_resolver_calls=True,
):
# Keep the short rescan interval and TTL patched for the whole test so a
# poll racing the swap between callbacks can't pick up the real DNS TTL.
with SrvPollingKnobs(ttl_time=WAIT_TIME, min_srv_rescan_interval=WAIT_TIME):
# Client uses unpatched method to get initial nodelist
client = self.simple_client(self.CONNECTION_STRING)
client._connect()
# Invalid DNS resolver response should not change nodelist.
self.assert_nodelist_nochange(self.BASE_SRV_RESPONSE, client)
with SrvPollingKnobs(nodelist_callback=initial_callback, count_resolver_calls=True):
# Invalid DNS resolver response should not change nodelist.
self.assert_nodelist_nochange(self.BASE_SRV_RESPONSE, client)

with SrvPollingKnobs(
ttl_time=WAIT_TIME, min_srv_rescan_interval=WAIT_TIME, nodelist_callback=final_callback
):
# Nodelist should reflect new valid DNS resolver response.
self.assert_nodelist_change(response_final, client)
with SrvPollingKnobs(nodelist_callback=final_callback):
# Nodelist should reflect new valid DNS resolver response.
self.assert_nodelist_change(response_final, client)

def test_recover_from_initially_empty_seedlist(self):
def empty_seedlist():
Expand Down
Loading