-
Notifications
You must be signed in to change notification settings - Fork 12
Fix broken assert actions and Python 3 related issues #154
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
Conversation
Action never threw an exception / exited with non-zero code on failed assert which means all the workflows which utilize this actions are broken aka don't fail correctly on failed assertion.
|
Tested the change using |
|
EDIT: It actually identified a real issue - somewhere in our remote script runner "id": "5cab6c6b25ec125678abbd61",
"parameters": {
"hosts": "localhost",
"int_arg": 1.0,
"obj_arg": {
"foo": "bar baz"
},
"str_arg": "foo bar\nbaz",
"stream": "stdout",
"sudo": true
},
"result": {
"localhost": {
"failed": false,
"return_code": 0,
"stderr": "",
"stdout": "STREAM IS STDOUT. STR: foo bar\r\nbaz INT: 1 OBJ: {u'foo': u'bar baz'}",
"succeeded": true
}
},
"status": "succeeded"
}```
Digging in... |
|
Fix for carriage return issue is here - StackStorm/st2#4623. This PR will fail until that fix is merged into StackStorm/st2 master. |
|
Fixed more broken assertion methods and looks like there are more tests failed which need to be fixed. |
object result. This way it works consistently and correctly under Python 2 and Python 3.
|
While working on this I also noticed some issues / inconsistencies between Python 2 and Python 3 which I'm also fixing in this PR. |
|
I can confirm that with this PR and the following fixes / changes end to end tests (st2-self-check) now pass under Python 2 and Python 3: |
|
Tested it again with latest packages from StackStorm/st2. We are all green again on all supported distros: EL7 Attempting Test tests.test_inquiry_chain...OK! (47s)
Attempting Test tests.test_inquiry_mistral...OK! (37s)
Attempting Test tests.test_key_triggers...OK! (34s)
Attempting Test tests.test_pack_install_tool...OK! (10s)
Attempting Test tests.test_packs_pack...OK! (84s)
Attempting Test tests.test_quickstart...OK! (23s)
Attempting Test tests.test_quickstart_key...OK! (7s)
Attempting Test tests.test_quickstart_local_script_actions...OK! (13s)
Attempting Test tests.test_quickstart_passive_sensor...OK! (6s)
Attempting Test tests.test_quickstart_polling_sensor...OK! (5s)
Attempting Test tests.test_quickstart_python_actions...OK! (13s)
Attempting Test tests.test_quickstart_remote_script_actions...OK! (16s)
Attempting Test tests.test_quickstart_rules...OK! (62s)
Attempting Test tests.test_quickstart_trace...OK! (17s)
Attempting Test tests.test_render_config_context...OK! (4s)
Attempting Test tests.test_run_pack_tests_tool...OK! (49s)
Attempting Test tests.test_timer_rule...OK! (39s)
Skipping tests.test_windows_runners...
Skipping tests.test_winrm_large_script...
Skipping tests.test_winrm_runners...
Attempting Example examples.mistral_examples...OK! (17s)
Attempting Example examples.orquesta-examples...OK! (9s)
SELF CHECK SUCCEEDED!
st2-self-check succeeded.Ubuntu 1604 Attempting Test tests.test_inquiry_chain...OK! (47s)
Attempting Test tests.test_inquiry_mistral...OK! (37s)
Attempting Test tests.test_key_triggers...OK! (33s)
Attempting Test tests.test_pack_install_tool...OK! (10s)
Attempting Test tests.test_packs_pack...OK! (76s)
Attempting Test tests.test_quickstart...OK! (21s)
Attempting Test tests.test_quickstart_key...OK! (6s)
Attempting Test tests.test_quickstart_local_script_actions...OK! (13s)
Attempting Test tests.test_quickstart_passive_sensor...OK! (6s)
Attempting Test tests.test_quickstart_polling_sensor...OK! (5s)
Attempting Test tests.test_quickstart_python_actions...OK! (11s)
Attempting Test tests.test_quickstart_remote_script_actions...OK! (14s)
Attempting Test tests.test_quickstart_rules...OK! (62s)
Attempting Test tests.test_quickstart_trace...OK! (16s)
Attempting Test tests.test_render_config_context...OK! (5s)
Attempting Test tests.test_run_pack_tests_tool...OK! (43s)
Attempting Test tests.test_timer_rule...OK! (39s)
Skipping tests.test_windows_runners...
Skipping tests.test_winrm_large_script...
Skipping tests.test_winrm_runners...
Attempting Example examples.mistral_examples...OK! (16s)
Attempting Example examples.orquesta-examples...OK! (7s)
SELF CHECK SUCCEEDED!
st2-self-check succeeded.Ubuntu 18.04 Attempting Test tests.test_inquiry_chain...OK! (46s)
Skipping tests.test_inquiry_mistral...
Attempting Test tests.test_key_triggers...OK! (33s)
Attempting Test tests.test_pack_install_tool...OK! (12s)
Attempting Test tests.test_packs_pack...OK! (80s)
Attempting Test tests.test_quickstart...OK! (21s)
Attempting Test tests.test_quickstart_key...OK! (6s)
Attempting Test tests.test_quickstart_local_script_actions...OK! (13s)
Attempting Test tests.test_quickstart_passive_sensor...OK! (7s)
Attempting Test tests.test_quickstart_polling_sensor...OK! (4s)
Attempting Test tests.test_quickstart_python_actions...OK! (13s)
Attempting Test tests.test_quickstart_remote_script_actions...OK! (17s)
Attempting Test tests.test_quickstart_rules...OK! (61s)
Attempting Test tests.test_quickstart_trace...OK! (17s)
Attempting Test tests.test_render_config_context...OK! (4s)
Attempting Test tests.test_run_pack_tests_tool...OK! (47s)
Attempting Test tests.test_timer_rule...OK! (39s)
Skipping tests.test_windows_runners...
Skipping tests.test_winrm_large_script...
Skipping tests.test_winrm_runners...
Skipping examples.mistral_examples...
Attempting Example examples.orquesta-examples...OK! (7s)
SELF CHECK SUCCEEDED!
st2-self-check succeeded. |
While working on unrelated fix in #153, I noticed that various assert actions are broken.
Some assert actions don't throw / exit with non-zero status code on failed assertion which means they don't work correctly - tests were relying on action failing if the assertion fails (other assertion actions indeed fail on failed assertion).
This pull request fixes the following assert actions:
asserts.object_key_string_equalsasserts.object_key_number_equalsasserts.object_key_number_greaterIt's likely that a bunch of tests will start failing once we merge this since they relied on broken assert action (even if the assertion failed, tests never failed due to the issue described above).
(it looks like this has been broken for a long time already)