Open tyll opened 4 years ago
Possible patch:
diff --git a/tests/tasks/test_802.1x_capath.yml b/tests/tasks/test_802.1x_capath.yml
index f98b1b2..b8d7949 100644
--- a/tests/tasks/test_802.1x_capath.yml
+++ b/tests/tasks/test_802.1x_capath.yml
@@ -79,13 +79,15 @@
- __NM_capath_ignored_NVRs
- name: Assert role behavior
+ vars:
+ expected_failure: __network_NM_NVR.stdout in __NM_capath_ignored_NVRs
+ failure: __network_connections_result.failed
assert:
- that: __network_connections_result.failed ==
- (__network_NM_NVR.stdout in __NM_capath_ignored_NVRs)
- msg: "Role {{ __network_connections_result.failed and 'failed'
- or 'did not fail' }} but was expected
- {{ (__network_NM_NVR.stdout in __NM_capath_ignored_NVRs)
- and '' or 'not' }} to fail. NM NVR: {{ __network_NM_NVR.stdout }}"
+ that: (failure and expected_failure) or
+ (not failure and not expected_failure)
+ msg: "Role {{ failure and 'failed' or 'did not fail' }} but was expected
+ {{ expected_failure and '' or 'not' }} to fail.
+ NM NVR: {{ __network_NM_NVR.stdout }}"
- name: Assert ping succeeded
assert:
@pcahyna are the Jinja2 requirements for the system roles documented anywhere? Please provide a URL if they are.
@tyll more formally here: https://github.com/oasis-roles/meta_standards#ansible-best-practices
don't compare booleans, this was fixed only very recently: https://github.com/pallets/jinja/issues/813
Originally posted by @pcahyna in https://github.com/linux-system-roles/network/pull/232/files