diff options
author | John O Loughlin <john.oloughlin@intel.com> | 2018-07-11 11:22:39 +0100 |
---|---|---|
committer | Rodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com> | 2018-07-12 16:57:13 +0100 |
commit | 8da1feb7267f4b04e543b2e2e6590e2de8c31237 (patch) | |
tree | 8cd06439567fd6e6450184005bfc04c23cdb7bd5 /yardstick/tests/unit | |
parent | 438f7b5100e05ed668a0ea90674008a391eb5784 (diff) |
Improve "get_server" function in Kubernetes context
When a kubernetes context is returning the node info it is
assumed that the first port defined is the ssh port which may
not be the case. This patch will address this issue by looking
for a defined port 22.
JIRA: YARDSTICK-1301
Change-Id: I65dee1bcf62f21ebcaefeaa2666bb0ad53f3876c
Signed-off-by: John O Loughlin <john.oloughlin@intel.com>
Diffstat (limited to 'yardstick/tests/unit')
-rw-r--r-- | yardstick/tests/unit/benchmark/contexts/test_kubernetes.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/yardstick/tests/unit/benchmark/contexts/test_kubernetes.py b/yardstick/tests/unit/benchmark/contexts/test_kubernetes.py index 3957aab91..512468fed 100644 --- a/yardstick/tests/unit/benchmark/contexts/test_kubernetes.py +++ b/yardstick/tests/unit/benchmark/contexts/test_kubernetes.py @@ -12,6 +12,7 @@ import unittest from yardstick.benchmark.contexts import base from yardstick.benchmark.contexts import kubernetes +from yardstick.common import constants from yardstick.orchestrator import kubernetes as orchestrator_kubernetes @@ -117,8 +118,8 @@ class KubernetesTestCase(unittest.TestCase): mock_get_pod_by_name): class Service(object): def __init__(self): - self.name = 'yardstick' self.node_port = 30000 + self.port = constants.SSH_PORT class Services(object): def __init__(self): @@ -135,8 +136,9 @@ class KubernetesTestCase(unittest.TestCase): mock_get_service_by_name.return_value = Services() mock_get_pod_by_name.return_value = Pod() mock_get_node_ip.return_value = '172.16.10.131' - - self.assertIsNotNone(self.k8s_context._get_server('server')) + server = self.k8s_context._get_server('server_name') + self.assertEqual('server_name', server['name']) + self.assertEqual(30000, server['ssh_port']) @mock.patch.object(kubernetes.KubernetesContext, '_create_rc') def test_create_rcs(self, mock_create_rc): |