Skip to content

Commit 0eb05d0

Browse files
committed
Adding tests for the changes in args.py
1 parent 09d8d20 commit 0eb05d0

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tests/unit/test_args.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,17 @@ def call_get_client_args(self, **override_kwargs):
115115
'partition_data': {},
116116
}
117117
call_kwargs.update(**override_kwargs)
118+
119+
# Bridge test's scoped_config to config_store for new _compute_socket_options implementation
120+
# The method now reads from config_store instead of receiving scoped_config as parameter
121+
scoped_config = call_kwargs.get('scoped_config', {})
122+
if scoped_config:
123+
for key, value in scoped_config.items():
124+
# Convert 'true'/'false' strings to boolean for tcp_keepalive
125+
if key == 'tcp_keepalive' and isinstance(value, str):
126+
value = value.lower() == 'true'
127+
self.config_store.set_config_variable(key, value)
128+
118129
return self.args_create.get_client_args(**call_kwargs)
119130

120131
def call_compute_client_args(self, **override_kwargs):
@@ -284,6 +295,16 @@ def test_tcp_keepalive_enabled_if_set_anywhere(self):
284295
+ [(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)],
285296
)
286297

298+
def test_tcp_keepalive_enabled_environment_variable(self):
299+
with mock.patch.dict('os.environ', {'BOTOCORE_TCP_KEEPALIVE': 'true'}):
300+
with mock.patch('botocore.args.EndpointCreator') as m:
301+
self.call_get_client_args()
302+
self.assert_create_endpoint_call(
303+
m,
304+
socket_options=self.default_socket_options
305+
+ [(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)],
306+
)
307+
287308
def test_tcp_keepalive_explicitly_disabled(self):
288309
scoped_config = {'tcp_keepalive': 'false'}
289310
with mock.patch('botocore.args.EndpointCreator') as m:

0 commit comments

Comments
 (0)