diff options
Diffstat (limited to 'functest_kubernetes/rally/rally_kubernetes.py')
-rw-r--r-- | functest_kubernetes/rally/rally_kubernetes.py | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/functest_kubernetes/rally/rally_kubernetes.py b/functest_kubernetes/rally/rally_kubernetes.py index e7a903d9..28415579 100644 --- a/functest_kubernetes/rally/rally_kubernetes.py +++ b/functest_kubernetes/rally/rally_kubernetes.py @@ -11,6 +11,7 @@ import logging import os import time +from jinja2 import Template import pkg_resources from rally import api from rally import exceptions @@ -26,6 +27,10 @@ class RallyKubernetes(testcase.TestCase): __logger = logging.getLogger(__name__) + concurrency = 1 + times = 1 + namespaces_count = 1 + def __init__(self, **kwargs): super(RallyKubernetes, self).__init__(**kwargs) self.dir_results = "/home/opnfv/functest/results" @@ -53,10 +58,14 @@ class RallyKubernetes(testcase.TestCase): "Cannot check env heath: %s", result['existing@kubernetes']['message']) return - input_task = open( - pkg_resources.resource_filename( - 'functest_kubernetes', 'rally/all-in-one.yaml')).read() - task = yaml.safe_load(input_task) + with open(pkg_resources.resource_filename( + 'functest_kubernetes', 'rally/all-in-one.yaml')) as file: + template = Template(file.read()) + task = yaml.safe_load(template.render( + concurrency=kwargs.get("concurrency", self.concurrency), + times=kwargs.get("times", self.times), + namespaces_count=kwargs.get( + "namespaces_count", self.namespaces_count))) rapi.task.validate(deployment='my-kubernetes', config=task) task_instance = rapi.task.create(deployment='my-kubernetes') rapi.task.start( |