aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuha Kosonen <juha.kosonen@nokia.com>2019-08-15 16:15:21 +0300
committerCédric Ollivier <cedric.ollivier@orange.com>2019-08-17 11:57:39 +0200
commit24fd0702d52add4d558251df18fdbb06e722e605 (patch)
tree1622ccaf27221f1d99bd3b412cd3a1b7bda38632
parentd8dc4a7ab42c3135ec0c5d3b8405ae98d1ccbd00 (diff)
Fix rally task file manipulation
Remove empty workload entries when applying blacklist in RallyJobs. Rally considers task file as invalid if it contains entries whose workload list empty. Change-Id: I34867c0aeea9c5ecf1294959d680e6de535be9cd Signed-off-by: Juha Kosonen <juha.kosonen@nokia.com> (cherry picked from commit 60c021dffb4297abd4810c4ceb4c2c4d9d07b619)
-rw-r--r--functest/opnfv_tests/openstack/rally/rally.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/functest/opnfv_tests/openstack/rally/rally.py b/functest/opnfv_tests/openstack/rally/rally.py
index 7438d7155..22b508afa 100644
--- a/functest/opnfv_tests/openstack/rally/rally.py
+++ b/functest/opnfv_tests/openstack/rally/rally.py
@@ -769,26 +769,26 @@ class RallyJobs(RallyBase):
cases.pop(name)
else:
# workloads in subtasks
- for sind, subtask in enumerate(cases.get('subtasks', [])):
- idx = []
- for wind, workload in enumerate(subtask.get('workloads', [])):
+ for sind, subtask in reversed(list(
+ enumerate(cases.get('subtasks', [])))):
+ for wind, workload in reversed(list(
+ enumerate(subtask.get('workloads', [])))):
scenario = workload.get('scenario', {})
for name in scenario.keys():
if self.in_iterable_re(name, black_tests):
- idx.append(wind)
+ cases['subtasks'][sind]['workloads'].pop(wind)
break
- for wind in reversed(idx):
- cases['subtasks'][sind]['workloads'].pop(wind)
+ if 'workloads' in cases['subtasks'][sind]:
+ if not cases['subtasks'][sind]['workloads']:
+ cases['subtasks'].pop(sind)
# scenarios in subtasks
- idx = []
- for sind, subtask in enumerate(cases.get('subtasks', [])):
+ for sind, subtask in reversed(list(
+ enumerate(cases.get('subtasks', [])))):
scenario = subtask.get('scenario', {})
for name in scenario.keys():
if self.in_iterable_re(name, black_tests):
- idx.append(sind)
+ cases['subtasks'].pop(sind)
break
- for sind in reversed(idx):
- cases['subtasks'].pop(sind)
with open(result_file_name, 'w') as fname:
template.dump(cases, fname)