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

Add tests for WANT_JSON and old style modules #50555

Merged
merged 8 commits into from Jan 9, 2019

Conversation

sivel
Copy link
Member

@sivel sivel commented Jan 4, 2019

SUMMARY

Add tests for WANT_JSON and old style modules

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

test/integration/targets/old_style_modules_posix
test/integration/targets/want_json_modules_posix

ADDITIONAL INFORMATION

@maxamillion
Copy link
Contributor

Awesome. 👍

@ansibot ansibot added affects_2.8 This issue/PR affects Ansible v2.8 community_review In order to be merged, this PR must follow the community review workflow. feature This issue/PR relates to a feature request. needs_triage Needs a first human triage before being processed. support:community This issue/PR relates to code supported by the Ansible community. labels Jan 4, 2019
@ansibot
Copy link
Contributor

ansibot commented Jan 4, 2019

@ansibot ansibot added core_review In order to be merged, this PR must follow the core review workflow. support:core This issue/PR relates to code supported by the Ansible Engineering Team. test This PR relates to tests. and removed community_review In order to be merged, this PR must follow the community review workflow. labels Jan 4, 2019
@ansibot ansibot added needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. and removed core_review In order to be merged, this PR must follow the core review workflow. labels Jan 4, 2019
@ansibot
Copy link
Contributor

ansibot commented Jan 4, 2019

The test ansible-test sanity --test shellcheck [explain] failed with 2 errors:

test/integration/targets/old_style_modules_posix/library/helloworld.sh:24:12: SC2154 salutation is referenced but not assigned (did you mean 'SALUTATION'?).
test/integration/targets/old_style_modules_posix/library/helloworld.sh:25:6: SC2154 name is referenced but not assigned (did you mean 'NAME'?).

click here for bot help

@ansibot ansibot added the ci_verified Changes made in this PR are causing tests to fail. label Jan 4, 2019
@sivel sivel removed needs_triage Needs a first human triage before being processed. labels Jan 4, 2019
@ansibot ansibot added core_review In order to be merged, this PR must follow the core review workflow. and removed ci_verified Changes made in this PR are causing tests to fail. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Jan 4, 2019
@maxamillion
Copy link
Contributor

shipit

@sivel sivel requested a review from mattclay January 8, 2019 16:11
@ansibot ansibot added shipit This PR is ready to be merged by Core and removed core_review In order to be merged, this PR must follow the core review workflow. labels Jan 8, 2019
else
echo '{"msg": "No argument file provided", "failed": True}'
exit 1
fi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this module includes an error check for no argument file, I'd include testing that in the integration test. Just execute it as a script instead of a module to verify it fails as expected.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in the latest commit

data = json.load(f)
except (IOError, OSError, IndexError):
print(json.dumps(dict(msg="No argument file provided", failed=True)))
sys.exit(1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this module includes an error check for no argument file, I'd include testing that in the integration test. Just execute it as a script instead of a module to verify it fails as expected.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in the latest commit

@ansibot ansibot added needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. and removed shipit This PR is ready to be merged by Core labels Jan 8, 2019
- assert:
that:
- direct is failed
- |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the multi-line syntax here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had done it originally due to simplifying quoting, but after a change it's no longer needed, I just didn't remove it. It wasn't done for multiline, but rather as a block literal, to avoid the need for outer quotes which would have complicated things.

@sivel sivel merged commit 6918b4e into ansible:devel Jan 9, 2019
kbreit pushed a commit to kbreit/ansible that referenced this pull request Jan 11, 2019
* Add tests for WANT_JSON and old style modules

* quote source path

* Attempt to further appease tests

* Check for file and not just exists

* omg don't be dumb

* moar fixes

* shellcheck is the worst :)

* Test the custom modules for failure without arg files
knumskull pushed a commit to knumskull/ansible that referenced this pull request Jan 21, 2019
* Add tests for WANT_JSON and old style modules

* quote source path

* Attempt to further appease tests

* Check for file and not just exists

* omg don't be dumb

* moar fixes

* shellcheck is the worst :)

* Test the custom modules for failure without arg files
@ansible ansible locked and limited conversation to collaborators Jul 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.8 This issue/PR affects Ansible v2.8 feature This issue/PR relates to a feature request. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. support:community This issue/PR relates to code supported by the Ansible community. support:core This issue/PR relates to code supported by the Ansible Engineering Team. test This PR relates to tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants