Skip to content
Snippets Groups Projects
Commit 50a405a9 authored by Guillaume Tucker's avatar Guillaume Tucker
Browse files

lava_results_app: fix exception when no action_metadata


When a TestCase object has no action_metadata associated with it, the
object attribute is None.  Check if this is the case before calling
dict methods on it, to fix exceptions like this one:

  [...]
    File "/usr/lib/python3/dist-packages/lava_results_app/dbutils.py", line 352, in walk_actions
      build_action(action, testdata, submission)
    File "/usr/lib/python3/dist-packages/lava_results_app/dbutils.py", line 332, in build_action
      if 'level' in case.action_metadata:
  TypeError: argument of type 'NoneType' is not iterable

Signed-off-by: default avatarGuillaume Tucker <guillaume.tucker@collabora.com>
parent 73f6b510
No related branches found
No related tags found
No related merge requests found
......@@ -329,8 +329,8 @@ def build_action(action_data, testdata, submission):
match_case = None
test_cases = TestCase.objects.filter(suite__job=testdata.testjob, suite__name='lava')
for case in test_cases:
if 'level' in case.action_metadata:
if case.action_metadata['level'] == action_data['level']:
if case.action_metadata:
if case.action_metadata.get('level') == action_data['level']:
match_case = case
# maps the static testdata derived from the definition to the runtime pipeline construction
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment