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
6 changes: 5 additions & 1 deletion cterasdk/asynchronous/core/notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand Down
6 changes: 1 addition & 5 deletions cterasdk/edge/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down
7 changes: 6 additions & 1 deletion cterasdk/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 3 additions & 1 deletion tests/ut/aio/test_notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
12 changes: 3 additions & 9 deletions tests/ut/edge/test_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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()
Expand All @@ -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()
Expand Down Expand Up @@ -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()
Expand Down