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

Enhancement idea: Use unit tests whenever possible instead of integration tests #1982

Open
1 task done
alinabuzachis opened this issue Feb 21, 2024 · 2 comments
Open
1 task done

Comments

@alinabuzachis
Copy link
Collaborator

Summary

We have many integration tests in the amazon.aws repository, even for very small plugin features. Integration testing is slow, and the need to create new resources to test even some small features results in a lot of overhead, which makes integration testing even slower. Some features can be easily tested without integration testing by simply writing some units. The idea would be to identify these cases and, instead of covering them with integration tests, add some unit tests. I would probably consider integration tests only for the main operations (create, idempotency checks, update, delete) with some relevant plugin options, and unit tests when testing the other functionalities.

Issue Type

Feature Idea

Component Name

Several

Additional Information

No response

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@gravesm
Copy link
Member

gravesm commented Mar 20, 2024

I would add that we should also try to come up with some guidelines for when to use unit tests and when to use integration tests, and document that.

@tremble
Copy link
Contributor

tremble commented Mar 20, 2024

The problem I have with saying "whenever possible", is that historically a lot of our code hasn't been written in such a way that unit tests are "useful". We probably need to take a step back and think about how we recommend modules are written, such that writing unit tests doesn't involve placebo recordings. (And preferably doesn't necessitate mocking up AnsibleModule and Boto3 Client's)

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

No branches or pull requests

3 participants