Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

don't compare booleans, this was fixed only very recently: https://github.com/pallets/jinja/issues/813 #245

Open
tyll opened this issue Jun 15, 2020 · 4 comments
Labels
low effort estimated to require a low effort medium impact estimated to make a medium impact test Issue regarding test coverage

Comments

@tyll
Copy link
Member

tyll commented Jun 15, 2020

don't compare booleans, this was fixed only very recently: pallets/jinja#813

Originally posted by @pcahyna in https://github.com/linux-system-roles/network/pull/232/files

@tyll tyll added low effort estimated to require a low effort medium impact estimated to make a medium impact test Issue regarding test coverage labels Jun 15, 2020
@tyll
Copy link
Member Author

tyll commented Jun 15, 2020

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:

@tyll
Copy link
Member Author

tyll commented Jun 16, 2020

@pcahyna are the Jinja2 requirements for the system roles documented anywhere? Please provide a URL if they are.

@pcahyna
Copy link
Member

pcahyna commented Jun 16, 2020

@tyll here: linux-system-roles/storage#49

@pcahyna
Copy link
Member

pcahyna commented Jun 16, 2020

@tyll tyll mentioned this issue Jun 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
low effort estimated to require a low effort medium impact estimated to make a medium impact test Issue regarding test coverage
Projects
None yet
Development

No branches or pull requests

2 participants