aboutsummaryrefslogtreecommitdiffstats
path: root/functest_kubernetes/rally/rally_kubernetes.py
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2020-08-22 16:36:19 +0200
committerCédric Ollivier <cedric.ollivier@orange.com>2020-08-22 18:22:40 +0200
commit21b1cfffd627dc6f10b3c82631cba91ed6472aa3 (patch)
treed60046fdd595ebe8a4696bf980154cae40ca3ded /functest_kubernetes/rally/rally_kubernetes.py
parent1a4fcb773c85b624039c25ac71bb43478d0de091 (diff)
Add xrally_kubernetes_full
It iterates 10 times all operations run by xrally_kubernetes. Now times, concurrenty and count can be set via testcases.yaml. It creates a new containers functest-kubernetes-benchamrking as Functest. Change-Id: Ibfd493b987a359a3f16c2d8db0aef6b8e90b7e92 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com> (cherry picked from commit a0f76d884c1f13c27e906136d3418f12b5342fc4)
Diffstat (limited to 'functest_kubernetes/rally/rally_kubernetes.py')
-rw-r--r--functest_kubernetes/rally/rally_kubernetes.py17
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(