summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Dent <chdent@redhat.com>2015-01-14 17:17:08 +0000
committerChris Dent <chdent@redhat.com>2015-01-14 17:21:26 +0000
commitd588748a36a36701d69f40b68bf3d62f20d76baf (patch)
tree1f5a0de0e28f5220c042b0778a75cbd97e04be17
parent87c1442469e76e338ee7eb0606e7e8caa525e056 (diff)
downloadtempest-lib-d588748a36a36701d69f40b68bf3d62f20d76baf.tar.gz
Default the worker number to 0 not NaN
If 'NaN' then the worker balance summary will fail with a TypeError. 0 makes sense in the common cases: * either you have worker tags and they are numbered * or you have no worker tags and thus you have just one worker, and we can call that worker '0' because it is the first one The 'NaN' shows up when you try to use subunit-trace in commands such as python -m subunit.run discover <dir|package> |subunit-trace which is something people are wont to do. Change-Id: Ibe18f16c0c360fc5a995fcf84e5bf2b6c16abd9c
-rwxr-xr-xtempest_lib/cmd/subunit_trace.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/tempest_lib/cmd/subunit_trace.py b/tempest_lib/cmd/subunit_trace.py
index ea59cc6..5ffaa7c 100755
--- a/tempest_lib/cmd/subunit_trace.py
+++ b/tempest_lib/cmd/subunit_trace.py
@@ -81,10 +81,15 @@ def get_duration(timestamps):
def find_worker(test):
+ """Get the worker number.
+
+ If there are no workers because we aren't in a concurrent environment,
+ assume the worker number is 0.
+ """
for tag in test['tags']:
if tag.startswith('worker-'):
return int(tag[7:])
- return 'NaN'
+ return 0
# Print out stdout/stderr if it exists, always