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

Improving Content handler tests #1722

Merged
merged 1 commit into from Jun 2, 2020
Merged

Improving Content handler tests #1722

merged 1 commit into from Jun 2, 2020

Conversation

fao89
Copy link
Member

@fao89 fao89 commented May 21, 2020

@fao89 fao89 requested a review from a team May 21, 2020 18:28
@pulpbot
Copy link
Member

pulpbot commented May 21, 2020

Attached issue: https://pulp.plan.io/issues/6778

@fao89 fao89 force-pushed the 6778 branch 2 times, most recently from 9730678 to 243ca7b Compare May 21, 2020 18:39
@goosemania goosemania requested review from dkliban and removed request for a team May 25, 2020 10:38
Copy link
Member

@dkliban dkliban left a 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.

Comment on lines +290 to +304
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
Copy link
Member Author

@fao89 fao89 May 28, 2020

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.

Copy link
Member

Choose a reason for hiding this comment

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

This is great!

@fao89 fao89 requested a review from dkliban May 28, 2020 21:27
Copy link
Member

@dkliban dkliban left a 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.

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

5 participants