openqa_server: try a new approach for checking test changes
basically, dump the config from the server before loading the templates file, dump it after, and use json_diff to compare. I wanted to make the actual template loading script from openQA do some kind of check in '--clean' mode, but given how it's designed that's not really terribly practical without doing some major re-architecting, and this seems like a relatively simple alternative. With this change, the actual "Load tests" step will never show 'changed', but the subsequent 'Check if the tests changed in previous step' step will show as changed when appropriate.
This commit is contained in:
parent
0e4f269a4c
commit
d8ef7c0ad6
1 changed files with 18 additions and 2 deletions
|
@ -50,6 +50,7 @@
|
|||
- libselinux-python
|
||||
- openqa
|
||||
- git
|
||||
- json_diff
|
||||
- libselinux-utils
|
||||
- libsemanage-python
|
||||
- nfs-utils
|
||||
|
@ -201,8 +202,23 @@
|
|||
when: "gittests|changed"
|
||||
changed_when: "1 != 1"
|
||||
|
||||
# This will always show as changed, even when nothing in the templates
|
||||
# changed; this is a bit hard to fix
|
||||
- name: Dump existing config for checking changes
|
||||
shell: "/usr/share/openqa/script/dump_templates --json > /tmp/tmpl-old.json"
|
||||
when: "gittests|changed"
|
||||
changed_when: "1 != 1"
|
||||
|
||||
# Because of the boring details of how template loading works, getting
|
||||
# a correct 'changed' for this step is too difficult. Instead we have
|
||||
# the prior and following steps; when the templates actually changed,
|
||||
# the *following* step will register as changed.
|
||||
- name: Load tests
|
||||
shell: "/tmp/templates --clean"
|
||||
when: "gittests|changed"
|
||||
changed_when: "1 != 1"
|
||||
|
||||
- name: Check if the tests changed in previous step
|
||||
command: "/usr/share/openqa/script/dump_templates --json > /tmp/tmpl-new.json && json_diff /tmp/tmpl-old.json /tmp/tmpl-new.json"
|
||||
when: "gittests|changed"
|
||||
register: testsdiff
|
||||
changed_when: "testsdiff.rc > 0"
|
||||
failed_when: "1 != 1"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue