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
Improving Content handler tests #1722
Conversation
|
Attached issue: https://pulp.plan.io/issues/6778 |
9730678
to
243ca7b
Compare
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.
I was expecting to see a new cleanup method introduced that would call delete on a resource and if a task is returned, it would wait for the task to finish before returning control.
https://pulp.plan.io/issues/6778 closes #6778 [nocoverage]
| class PulpTestCase(TestCase): | ||
| """Pulp customized test case.""" | ||
|
|
||
| def doCleanups(self): | ||
| """ | ||
| Execute all cleanup functions and waits the deletion tasks. | ||
|
|
||
| Normally called for you after tearDown. | ||
| """ | ||
| output = super().doCleanups() | ||
| running_tasks = tasks.list(state="running", name__contains="delete") | ||
| while running_tasks.count: | ||
| sleep(0.3) | ||
| running_tasks = tasks.list(state="running", name__contains="delete") | ||
| return output |
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.
As the other tests were using addCleanup I introduced this TestCase that waits for the deletion tasks.
0.3 seconds as in pulp-smash.
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.
This is great!
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.
Let's merge this now, but I think it would be better if we provided this class in pulp-smash instead.
https://pulp.plan.io/issues/6778
closes #6778