diff --git a/cterasdk/asynchronous/core/notifications.py b/cterasdk/asynchronous/core/notifications.py index ed05da87..1199095a 100644 --- a/cterasdk/asynchronous/core/notifications.py +++ b/cterasdk/asynchronous/core/notifications.py @@ -69,7 +69,11 @@ async def changes(self, cursor, cloudfolders=None, timeout=None): param = await self._create_parameter(cloudfolders, cursor) param.timeout = timeout if timeout else 10000 logger.debug('Checking for updates. %s', {'timeout': param.timeout}) - return (await self._core.v2.api.post('/metadata/longpoll', param)).changes + return (await self._core.v2.api.post('/metadata/longpoll', param, **{ + 'timeout': { + 'sock_read': param.timeout + 10000 + } + })).changes async def ancestors(self, descendant): """ diff --git a/cterasdk/edge/network.py b/cterasdk/edge/network.py index fb273815..9ffe84e2 100644 --- a/cterasdk/edge/network.py +++ b/cterasdk/edge/network.py @@ -126,11 +126,7 @@ def tcp_connect(self, service): logger.info("Testing connection. %s", {'host': service.host, 'port': service.port}) - task = self._edge.api.execute("/status/network", "tcpconnect", param, { - 'timeout': { - 'sock_read': 120 - } - }) + task = self._edge.api.execute("/status/network", "tcpconnect", param) try: task = self._edge.tasks.wait(task) logger.debug("Obtained connection status. %s", {'status': task.result.rc}) diff --git a/cterasdk/settings.yml b/cterasdk/settings.yml index 6929970e..f4bd1648 100644 --- a/cterasdk/settings.yml +++ b/cterasdk/settings.yml @@ -33,7 +33,12 @@ core: # CTERA Edge Filer synchronous client configuration. edge: syn: - <<: *default_settings + settings: + <<: *cookie_jar + <<: *connector + timeout: + sock_connect: 30 + sock_read: 60 services: ssl: prompt asyn: diff --git a/tests/ut/aio/test_notifications.py b/tests/ut/aio/test_notifications.py index c7bb8c94..d3d509a7 100644 --- a/tests/ut/aio/test_notifications.py +++ b/tests/ut/aio/test_notifications.py @@ -77,7 +77,9 @@ async def generator(): async def test_changes_defaults_no_changes(self): self._init_global_admin(post_response=TestAsyncCoreNotifications._create_changes_response(False)) await notifications.Notifications(self._global_admin).changes(self._cursor) - self._global_admin.v2.api.post.assert_called_once_with('/metadata/longpoll', mock.ANY) + self._global_admin.v2.api.post.assert_called_once_with('/metadata/longpoll', mock.ANY, timeout={ + 'sock_read': 20000 + }) expected_param = TestAsyncCoreNotifications._create_parameter(cursor=self._cursor, timeout=10000) actual_param = self._global_admin.v2.api.post.call_args[0][1] self.assert_equal_objects(actual_param, expected_param) diff --git a/tests/ut/edge/test_network.py b/tests/ut/edge/test_network.py index a78e86d3..f04f5e0b 100644 --- a/tests/ut/edge/test_network.py +++ b/tests/ut/edge/test_network.py @@ -49,12 +49,6 @@ def setUp(self): self._proxy_user = 'admin' self._proxy_pass = 'password' - self._timeout = { - 'timeout': { - 'sock_read': 120 - } - } - def test_network_status(self): get_response = 'Success' self._init_filer(get_response=get_response) @@ -143,7 +137,7 @@ def test_tcp_connect_success(self): ret = network.Network(self._filer).tcp_connect(TCPService(self._tcp_connect_address, self._tcp_connect_port)) - self._filer.api.execute.assert_called_once_with('/status/network', 'tcpconnect', mock.ANY, self._timeout) + self._filer.api.execute.assert_called_once_with('/status/network', 'tcpconnect', mock.ANY) self._filer.tasks.wait.assert_called_once_with(self._task_id) expected_param = self._get_tcp_connect_object() @@ -163,7 +157,7 @@ def test_tcp_connect_failure(self): ret = network.Network(self._filer).tcp_connect(TCPService(self._tcp_connect_address, self._tcp_connect_port)) - self._filer.api.execute.assert_called_once_with('/status/network', 'tcpconnect', mock.ANY, self._timeout) + self._filer.api.execute.assert_called_once_with('/status/network', 'tcpconnect', mock.ANY) self._filer.tasks.wait.assert_called_once_with(self._task_id) expected_param = self._get_tcp_connect_object() @@ -206,7 +200,7 @@ def test_tcp_connect_task_error(self): ret = network.Network(self._filer).tcp_connect(TCPService(self._tcp_connect_address, self._tcp_connect_port)) - self._filer.api.execute.assert_called_once_with('/status/network', 'tcpconnect', mock.ANY, self._timeout) + self._filer.api.execute.assert_called_once_with('/status/network', 'tcpconnect', mock.ANY) self._filer.tasks.wait.assert_called_once_with(self._task_id) expected_param = self._get_tcp_connect_object()