Merge "Do not rely on ps to check the daemon"
This commit is contained in:
commit
8d837f04d2
@ -207,20 +207,22 @@ class BaseKuryrScenarioTest(manager.NetworkScenarioTest):
|
|||||||
return kuryr_if['versioned_object.data']['id']
|
return kuryr_if['versioned_object.data']['id']
|
||||||
|
|
||||||
def exec_command_in_pod(self, pod_name, command, namespace="default",
|
def exec_command_in_pod(self, pod_name, command, namespace="default",
|
||||||
stderr=False):
|
stderr=False, container=None):
|
||||||
api = self.k8s_client.CoreV1Api()
|
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
|
||||||
if stderr:
|
if stderr:
|
||||||
|
kwargs['_preload_content'] = False
|
||||||
resp = stream(api.connect_get_namespaced_pod_exec, pod_name,
|
resp = stream(api.connect_get_namespaced_pod_exec, pod_name,
|
||||||
namespace, command=command, stderr=True,
|
namespace, **kwargs)
|
||||||
stdin=False, stdout=True, tty=False,
|
|
||||||
_preload_content=False)
|
|
||||||
# Run until completion
|
# Run until completion
|
||||||
resp.run_forever()
|
resp.run_forever()
|
||||||
return resp.read_stdout(), resp.read_stderr()
|
return resp.read_stdout(), resp.read_stderr()
|
||||||
else:
|
else:
|
||||||
return stream(api.connect_get_namespaced_pod_exec, pod_name,
|
return stream(api.connect_get_namespaced_pod_exec, pod_name,
|
||||||
namespace, command=command, stderr=False,
|
namespace, **kwargs)
|
||||||
stdin=False, stdout=True, tty=False)
|
|
||||||
|
|
||||||
def assign_fip_to_pod(self, pod_name, namespace="default"):
|
def assign_fip_to_pod(self, pod_name, namespace="default"):
|
||||||
ext_net_id = CONF.network.public_network_id
|
ext_net_id = CONF.network.public_network_id
|
||||||
|
@ -36,9 +36,11 @@ class TestKuryrDaemon(base.BaseKuryrScenarioTest):
|
|||||||
namespace = CONF.kuryr_kubernetes.kube_system_namespace
|
namespace = CONF.kuryr_kubernetes.kube_system_namespace
|
||||||
kube_system_pods = self.get_pod_name_list(
|
kube_system_pods = self.get_pod_name_list(
|
||||||
namespace=namespace)
|
namespace=namespace)
|
||||||
cmd = ["ps", "aux"]
|
cmd = ['cat', '/proc/1/cmdline']
|
||||||
|
|
||||||
for kuryr_pod_name in kube_system_pods:
|
for kuryr_pod_name in kube_system_pods:
|
||||||
if kuryr_pod_name.startswith('kuryr-cni'):
|
if kuryr_pod_name.startswith('kuryr-cni'):
|
||||||
self.assertIn('kuryr-daemon', self.exec_command_in_pod(
|
self.assertIn(
|
||||||
kuryr_pod_name, cmd, namespace))
|
'kuryr-daemon --config-file',
|
||||||
|
self.exec_command_in_pod(kuryr_pod_name, cmd, namespace,
|
||||||
|
container='kuryr-cni'))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user