Skip to content

python: add more tests for connection persistence #126

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
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
10 changes: 6 additions & 4 deletions python/test_integration_boto3.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@ def test_check_if_rack_and_datacenter_set_correctly_wrong_dc(self):
pass

def test_http_connection_persistent(self):
self._test_connection_persistent("http")
self._test_connection_persistent("http", 1)
self._test_connection_persistent("http", 2)

def test_https_connection_persistent(self):
self._test_connection_persistent("https")
self._test_connection_persistent("https", 1)
self._test_connection_persistent("https", 2)

def _test_connection_persistent(self, schema: str):
def _test_connection_persistent(self, schema: str, max_pool_connections: int):
cnt = 0
if schema == "http":
original_init = urllib3.connection.HTTPConnection.__init__
Expand All @@ -41,7 +43,6 @@ def _test_connection_persistent(self, schema: str):
def wrapper(self, *args, **kwargs):
nonlocal cnt
nonlocal original_init
print(f'Wrapper: args={args}, kwargs={kwargs}')
cnt += 1
return original_init(self, *args, **kwargs)

Expand All @@ -59,6 +60,7 @@ def wrapper(self, *args, **kwargs):
port=self.http_port if schema == "http" else self.https_port,
datacenter="fake_dc",
update_interval=0,
max_pool_connections=max_pool_connections,
))

dynamodb = lb.new_boto3_dynamodb_client()
Expand Down