diff --git a/kuryr_tempest_plugin/tests/scenario/base.py b/kuryr_tempest_plugin/tests/scenario/base.py index 2f8eeadd..afa532ee 100644 --- a/kuryr_tempest_plugin/tests/scenario/base.py +++ b/kuryr_tempest_plugin/tests/scenario/base.py @@ -218,12 +218,18 @@ class BaseKuryrScenarioTest(manager.NetworkScenarioTest): return kuryr_if['versioned_object.data']['id'] def exec_command_in_pod(self, pod_name, command, namespace="default", - stderr=False, container=None): + stderr=False, container=None, req_timeout=20): api = self.k8s_client.CoreV1Api() kwargs = dict(command=command, stdin=False, stdout=True, tty=False, stderr=stderr) if container is not None: kwargs['container'] = container + # NOTE(yboaron): sometimes the 'connect_get_namespaced_pod_exec' + # call is hanging from some reason (on OS select) although the command + # completed. To resolve that we set the '_request_timeout' value. + # see https://github.com/kubernetes-client/python/issues/559 + if req_timeout is not None: + kwargs['_request_timeout'] = req_timeout if stderr: kwargs['_preload_content'] = False resp = stream(api.connect_get_namespaced_pod_exec, pod_name,