Increase timeout to read pod commands results

exec_command_in_pod was hanging from time to time and we've set a 10
seconds timeout waiting for a response from it. This might be too little
as we very often see empty responses being returned. This commit
attempts to solve the issue by setting default timeout to 60 seconds.
Also the method used is changed from connect_get_namespaced_pod_exec to
connect_post_namespaced_pod_exec. This is what `kubectl` uses to
perform `exec`, so hopefully it'll be more reliable.

Depends-On: I3bbac8e90553be9424fa0ecdb4c05e096da8f2d7
Change-Id: I49ac4d066a0bd0da3833dcbf41655f7c9e374fd9
This commit is contained in:
Michał Dulko 2020-11-04 15:24:28 +01:00
parent 28fbe115eb
commit fd25366d35
1 changed files with 2 additions and 2 deletions

View File

@ -333,7 +333,7 @@ class BaseKuryrScenarioTest(manager.NetworkScenarioTest):
def exec_command_in_pod(self, pod_name, command, namespace="default",
stderr=False, container=None,
req_timeout=10, f_timeout=2):
req_timeout=60, f_timeout=2):
api = self.k8s_client.CoreV1Api()
kwargs = dict(command=command, stdin=False, stdout=True, tty=False,
stderr=stderr)
@ -355,7 +355,7 @@ class BaseKuryrScenarioTest(manager.NetworkScenarioTest):
kwargs['_request_timeout'] = req_timeout
if stderr:
kwargs['_preload_content'] = False
resp = stream(api.connect_get_namespaced_pod_exec,
resp = stream(api.connect_post_namespaced_pod_exec,
pod_name, namespace, **kwargs)
# Run until completion
resp.run_forever(timeout=f_timeout)