diff options
author | John O Loughlin <john.oloughlin@intel.com> | 2018-05-11 18:09:54 +0100 |
---|---|---|
committer | Rodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com> | 2018-07-06 09:02:21 +0000 |
commit | ab8629071966fb46a4eeac473cda3352424fa350 (patch) | |
tree | d151462673de51b90f54b7b7ea178225be1e0efe /yardstick/tests/unit | |
parent | 42d82c8766fc449e4f495ce0d727ea3499a8b6de (diff) |
Add "env" parameter in Kubernetes context
This new parameter, "env", will allow the user to
automatically to add environment variables in a pod definition
Example of definition in a context:
context:
type: Kubernetes
servers:
host:
image: ...
commands: ...
env:
- <variable name>: <variable value>
- <variable name>: <variable value>
The volume type and the definition must be one of the supported
ones in Kubernetes [1].
[1] https://kubernetes.io/docs/concepts/storage/volumes/#types-of-volumes
JIRA: YARDSTICK-1161
Change-Id: Icf372a98c090063f10c9217755519ab92ba9b0ba
Signed-off-by: John O Loughlin <john.oloughlin@intel.com>
Diffstat (limited to 'yardstick/tests/unit')
-rw-r--r-- | yardstick/tests/unit/orchestrator/test_kubernetes.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/yardstick/tests/unit/orchestrator/test_kubernetes.py b/yardstick/tests/unit/orchestrator/test_kubernetes.py index 70d17e216..5eba1a02a 100644 --- a/yardstick/tests/unit/orchestrator/test_kubernetes.py +++ b/yardstick/tests/unit/orchestrator/test_kubernetes.py @@ -285,6 +285,23 @@ class ContainerObjectTestCase(base.BaseUnitTestCase): 'securityContext': {'key': 'value'}} self.assertEqual(expected, container_obj.get_container_item()) + def test_get_container_item_with_env(self): + volume_mount = {'name': 'fake_name', + 'mountPath': 'fake_path'} + args = ['arg1', 'arg2'] + container_obj = kubernetes.ContainerObject( + 'cname', ssh_key='fake_sshkey', volumeMount=[volume_mount], + args=args, env=[{'name': 'fake_var_name', + 'value': 'fake_var_value'}]) + expected = {'args': args, + 'command': [kubernetes.ContainerObject.COMMAND_DEFAULT], + 'image': kubernetes.ContainerObject.IMAGE_DEFAULT, + 'name': 'cname-container', + 'volumeMounts': container_obj._create_volume_mounts(), + 'env': [{'name': 'fake_var_name', + 'value': 'fake_var_value'}]} + self.assertEqual(expected, container_obj.get_container_item()) + class CustomResourceDefinitionObjectTestCase(base.BaseUnitTestCase): |