aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuha Kosonen <juha.kosonen@nokia.com>2019-08-15 16:15:21 +0300
committerJuha Kosonen <juha.kosonen@nokia.com>2019-08-16 10:15:07 +0000
commit66aca089c2c7aca7122bc2fa2cdcfacf8d65930e (patch)
treeb5d1e01bf1c4b5361a179e596aa04008df62abac
parent4616553c95e3ad9a78fae2a52ec256e554eb8807 (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>
-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 a0439d142..219aa0bed 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)