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

Capture module failure in class ModuleResult #48

Merged
merged 3 commits into from Oct 26, 2020
Merged

Capture module failure in class ModuleResult #48

merged 3 commits into from Oct 26, 2020

Conversation

PrieJos
Copy link
Contributor

@PrieJos PrieJos commented Aug 6, 2020

Hello,

I am using pytest_ansible in one of my projects. In particular I am using pytest_ansible to test an action plugin I have developed. However, during the development of my negative test cases, I found the property is_failed in class ModuleResult is not catching the module failure due to the fact the class ResultAccumulator (the callback plugin capturing ansible result during test execution) did not include the key failed within ModuleResult. This PR includes just a few modifications based in version 2.2.2 which fix basically that allowing me now to assert on for instance contacted.localhost.is_failed upon a module error.

Cheers
Jose M. Prieto

Signed-off-by: Jose M. Prieto <jose.prieto@roche.com>
If module fails the callback plugin captures the event by adding
fields "rc" and "failed" to the return dict so that properties
like "is_failed" later on returns True

Signed-off-by: Jose M. Prieto <jose.prieto@roche.com>
Signed-off-by: Jose M. Prieto <jose.prieto@roche.com>
@coveralls
Copy link

coveralls commented Aug 6, 2020

Pull Request Test Coverage Report for Build 210

  • 1 of 6 (16.67%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.3%) to 60.856%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pytest_ansible/module_dispatcher/v28.py 0 5 0.0%
Totals Coverage Status
Change from base Build 209: -0.3%
Covered Lines: 384
Relevant Lines: 631

💛 - Coveralls

@kdelee
Copy link
Member

kdelee commented Sep 11, 2020

👋 hello this looks pretty good.

I'd like to give this project a bit of care and feeding (fix up CI) and maybe get a release out next week sometime. Let me see how far I get and we can try and get this merged and in that release.

@kdelee
Copy link
Member

kdelee commented Oct 26, 2020

As is evident, i did not get very far. Let's merge this and work from there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants