aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--yardstick/orchestrator/kubernetes.py6
-rw-r--r--yardstick/tests/unit/orchestrator/test_kubernetes.py13
2 files changed, 19 insertions, 0 deletions
diff --git a/yardstick/orchestrator/kubernetes.py b/yardstick/orchestrator/kubernetes.py
index 3e2572fcc..8d9fc41c9 100644
--- a/yardstick/orchestrator/kubernetes.py
+++ b/yardstick/orchestrator/kubernetes.py
@@ -41,6 +41,8 @@ class ContainerObject(object):
self._resources = kwargs.get('resources', {})
self._ports = kwargs.get('ports', [])
self._image_pull_policy = kwargs.get('imagePullPolicy')
+ self._tty = kwargs.get('tty')
+ self._stdin = kwargs.get('stdin')
@staticmethod
def _parse_commands(command):
@@ -99,6 +101,10 @@ class ContainerObject(object):
if self._image_pull_policy not in self.IMAGE_PULL_POLICY:
raise exceptions.KubernetesContainerWrongImagePullPolicy()
container['imagePullPolicy'] = self._image_pull_policy
+ if self._stdin is not None:
+ container['stdin'] = self._stdin
+ if self._tty is not None:
+ container['tty'] = self._tty
return container
diff --git a/yardstick/tests/unit/orchestrator/test_kubernetes.py b/yardstick/tests/unit/orchestrator/test_kubernetes.py
index be9c2ae24..a73a4a132 100644
--- a/yardstick/tests/unit/orchestrator/test_kubernetes.py
+++ b/yardstick/tests/unit/orchestrator/test_kubernetes.py
@@ -405,6 +405,19 @@ class ContainerObjectTestCase(base.BaseUnitTestCase):
'imagePullPolicy':'Always'}
self.assertEqual(expected, container_obj.get_container_item())
+ def test_get_container_item_with_tty_stdin(self):
+ args = ['arg1', 'arg2']
+ container_obj = kubernetes.ContainerObject(
+ 'cname', 'fake_sshkey', args=args, tty=False, stdin=True)
+ expected = {'args': args,
+ 'command': kubernetes.ContainerObject.COMMAND_DEFAULT,
+ 'image': kubernetes.ContainerObject.IMAGE_DEFAULT,
+ 'name': 'cname-container',
+ 'volumeMounts': container_obj._create_volume_mounts(),
+ 'tty': False,
+ 'stdin': True}
+ self.assertEqual(expected, container_obj.get_container_item())
+
def test__parse_commands_string(self):
container_obj = kubernetes.ContainerObject('cname', 'fake_sshkey')
self.assertEqual(['fake command'],