-
Notifications
You must be signed in to change notification settings - Fork 23.7k
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
Fix test-module failing to validate args #41004
Conversation
The test-module pass a wrong argument _ansible_tmp cause the validation failed. Change the argument _ansible_tmp to _ansible_tmpdir to fix this.
Prior to this change, we don't have a test for test-module. This change ensure the correctness of test-module script.
Prior to this change, This change
Tests are failing for an unrelated reason. +1 to merge EDIT Oops, frrebsd tests are failing for a valid reason. See sivel's message. |
|
||
|
||
PING_MODULE_PATH="$(pwd)/../../../../lib/ansible/modules/system/ping.py" | ||
../../../../hacking/test-module -m "$PING_MODULE_PATH" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tests are failing because freebsd doesn't have /usr/bin/python
, so you will need to adjust this to use something like:
../../../../hacking/test-module -m "$PING_MODULE_PATH" -I ansible_python_interpreter=$(which python)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All right, I will try this, thanks!
Prior to this change, test-module will raise "No such file" error since freebsd doesn't have /usr/bin/python.
Make sure runme.sh can pass the shell sanity check.
The test
|
|
||
# ensure test-module script works well | ||
PING_MODULE_PATH="$(pwd)/../../../../lib/ansible/modules/system/ping.py" | ||
../../../../hacking/test-module -m "$PING_MODULE_PATH" -I ansible_python_interpreter=$(which python) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test/integration/targets/test_infra/runme.sh:27:86: SC2046 Quote this to prevent word splitting.
@HD650 this linter message means that in the event of command in $(...)
expression returning smth with space the command fill likely break. For example, if it returns /usr/bin/env python
it will result in smth like ... -I ansible_python_interpreter=/usr/bin/env python
, which is not what you want. Instead, you expect all of it to go to the same arg, like ... -I ansible_python_interpreter="/usr/bin/env python"
.
To fix this, just wrap argument with double quotes "
(single quotes prevent bash expression interpolation, which will break things).
Good work! Merged to devel for 2.7 |
FTR: this regression has been introduced by https://github.com/ansible/ansible/pull/39833/files#diff-3934fe5332a78d0a3719f8e468f72272L128 18 days ago |
* Fix test-module failing to validate args The test-module pass a wrong argument _ansible_tmp cause the validation failed. Change the argument _ansible_tmp to _ansible_tmpdir to fix this. * Add a integration test for test-module. Prior to this change, we don't have a test for test-module. This change ensure the correctness of test-module script.
* Fix test-module failing to validate args The test-module pass a wrong argument _ansible_tmp cause the validation failed. Change the argument _ansible_tmp to _ansible_tmpdir to fix this. * Add a integration test for test-module. Prior to this change, we don't have a test for test-module. This change ensure the correctness of test-module script.
* Fix test-module failing to validate args The test-module pass a wrong argument _ansible_tmp cause the validation failed. Change the argument _ansible_tmp to _ansible_tmpdir to fix this. * Add a integration test for test-module. Prior to this change, we don't have a test for test-module. This change ensure the correctness of test-module script.
SUMMARY
The test-module pass a wrong argument _ansible_tmp cause the validation failed.
Change the argument _ansible_tmp to _ansible_tmpdir to fix this.
Fixes #40817
Co-authored-by: Sviat wk@sydorenko.org.ua
ISSUE TYPE
COMPONENT NAME
test-module
ANSIBLE VERSION
ADDITIONAL INFORMATION
N/A