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

Ensure resources aren't left running after test run #206

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tompscanlan
Copy link

@tompscanlan tompscanlan commented Apr 21, 2021

What does this PR do?

Allocate the base resource_group as a fixture, and clean it up before exiting the test session resulting in removal of all test created resources.

Changes:

  • move resource group fixture to session and add local ctx fixture to enable bumping up to acct 6. (related to request at but no longer blocked by https://gitlab.com/saltstack/pop/pytest-pop/-/merge_requests/4)
  • make resource_group fixture allocate the resource group instead of just creating a string, and clean up on session exit
  • update resource group test since it is now a fixture
  • move duplicated password fixture up to the common fixture config

Signed-off-by: Tom Scanlan [email protected]

What issues does this PR fix or reference?

Fixes: #205 and #207

Previous Behavior

Previous resource_group fixture was a just the name of the group to create, and the creation was done in one of the first tests. Stopping the test run early would leave resources behind in this resource group, racking up $$.

New Behavior

Make the RG a fixture with a life for the entire session. Killing the test session should result in a clean up of everything in the resource group.

Merge requirements satisfied?

[NOTICE] Bug fixes or features added to idem-azurerm require tests.

  • Docs
  • Tests written/updated

Commits signed with GPG?

No

Please review idem-azurerm's Contributing Guide for best practices.

See GitHub's page on GPG signing for more information about signing commits with GPG.

@tompscanlan tompscanlan force-pushed the make-testing-less-expensive-by-default branch from 144e7b2 to c6bb95d Compare April 22, 2021 13:53
@nicholasmhughes nicholasmhughes requested a review from Ajnbro April 22, 2021 14:15
Ajnbro
Ajnbro previously approved these changes Apr 26, 2021
Copy link
Contributor

@Ajnbro Ajnbro left a comment

Choose a reason for hiding this comment

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

@Ajnbro Ajnbro added Documentation Improvements or additions to documentation Enhancement New feature or request labels Apr 26, 2021
@tompscanlan tompscanlan force-pushed the make-testing-less-expensive-by-default branch from c6bb95d to 22e0cd2 Compare April 26, 2021 15:36
@tompscanlan
Copy link
Author

tompscanlan commented Apr 26, 2021

@Ajnbro this no longer needs to wait on the pytest-pop update. I've replaced the ctx fixture in the local tests. I'm open to staying blocked, but current change works without waiting on the upstream change.

ignore this.

@tompscanlan tompscanlan changed the title WIP: Ensure resources aren't left running after test run Ensure resources aren't left running after test run Apr 26, 2021
@tompscanlan
Copy link
Author

Ignore me above... found the problem in pytest-pop, and it is fixed. 6.4 will have a fix for the ctx fixture, so cleaning up and pointing at 6.4 (yet to be cut).

@tompscanlan tompscanlan force-pushed the make-testing-less-expensive-by-default branch 3 times, most recently from 0860f88 to f3e510f Compare April 27, 2021 17:50
* bump to pop 17 and acct 6
* fix the acct-v6 problem in pytest-pop, bump to new version  (related https://gitlab.com/saltstack/pop/pytest-pop/-/merge_requests/4)
* make resource_group fixture allocate the resource group instead of just creating a string
* update resource group test since it is now a fixture
* on shutdown of the test session, remove the resource group which should cascade to remove all resources in the group
* move duplicated password fixture up to the common fixture config
* mark some tests as expensive and document testing

Signed-off-by: Tom Scanlan <[email protected]>
@tompscanlan tompscanlan force-pushed the make-testing-less-expensive-by-default branch from f3e510f to 3a9d902 Compare April 27, 2021 17:51
@tompscanlan
Copy link
Author

Looks like pytest-pop has been bumped. Tests are passing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Improvements or additions to documentation Enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Prevent unintended expenses due to testing
2 participants