Issue #6778
closedcontent handler test fails every now and then
Description
It seems that sometines cleanup happens too early. To my knowledge, resources are cleaned after each test method. My guess is that the problem is that all resources and cleanups are introduced in the setUp. And then both test methods re-use the created resources. It seems that cleanup happens either too soon or just for the second time.
It's the only test class written that way. https://github.com/pulp/pulp_rpm/blob/ddb279b1dfba727a548e360388fedcc0e63732bd/pulp_rpm/tests/functional/content_handler/test_config_repo.py#L42-L57
Any other tests we have don't create resources or schedule cleanups in the setUp, everything happens in each test method.
Error seen in Travis:
1753pulp_rpm/tests/functional/content_handler/test_config_repo.py::ContentHandlerTests::testConfigRepoUnsigned PASSED [100%]
1754pulp_rpm/tests/functional/content_handler/test_config_repo.py::ContentHandlerTests::testConfigRepoUnsigned ERROR [100%]
1755
1756==================================== ERRORS ====================================
1757_______ ERROR at teardown of ContentHandlerTests.testConfigRepoUnsigned ________
1758
1759cls = <class 'pulp_rpm.tests.functional.content_handler.test_config_repo.ContentHandlerTests'>
1760
1761 @classmethod
1762 def tearDownClass(cls) -> None:
1763 """Clean up after testing."""
1764 for f, x in cls.cleanUp:
1765> f(x)
1766
1767pulp_rpm/tests/functional/content_handler/test_config_repo.py:30:
1768_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
1769../../../virtualenv/python3.7.6/lib/python3.7/site-packages/pulpcore/client/pulp_rpm/api/publications_rpm_api.py:174: in delete
1770 return self.delete_with_http_info(rpm_publication_href, **kwargs) # noqa: E501
1771../../../virtualenv/python3.7.6/lib/python3.7/site-packages/pulpcore/client/pulp_rpm/api/publications_rpm_api.py:253: in delete_with_http_info
1772 collection_formats=collection_formats)
1773../../../virtualenv/python3.7.6/lib/python3.7/site-packages/pulpcore/client/pulp_rpm/api_client.py:353: in call_api
1774 _preload_content, _request_timeout, _host)
1775../../../virtualenv/python3.7.6/lib/python3.7/site-packages/pulpcore/client/pulp_rpm/api_client.py:184: in __call_api
1776 _request_timeout=_request_timeout)
1777../../../virtualenv/python3.7.6/lib/python3.7/site-packages/pulpcore/client/pulp_rpm/api_client.py:420: in request
1778 body=body)
1779../../../virtualenv/python3.7.6/lib/python3.7/site-packages/pulpcore/client/pulp_rpm/rest.py:266: in DELETE
1780 body=body)
E pulpcore.client.pulp_rpm.exceptions.ApiException: (404)
1912E Reason: Not Found
1913E HTTP response headers: HTTPHeaderDict({'Server': 'nginx/1.18.0', 'Date': 'Wed, 20 May 2020 07:47:02 GMT', 'Content-Type': 'application/json', 'Content-Length': '23', 'Connection': 'keep-alive', 'Vary': 'Accept, Cookie', 'Allow': 'GET, DELETE, HEAD, OPTIONS', 'X-Frame-Options': 'SAMEORIGIN'})
1914E HTTP response body: {"detail":"Not found."}
1915
1916../../../virtualenv/python3.7.6/lib/python3.7/site-packages/pulpcore/client/pulp_rpm/rest.py:229: ApiException
Updated by dkliban@redhat.com over 4 years ago
The DELETE calls for a lot of the resources are asynchronous. The cleanup methods are not aware of that. So once the initial API call is made to delete the resource, the test thinks the cleanup has already occurred. We need to introduce a cleanup method that waits for a task to finish before returning.
Updated by ttereshc over 4 years ago
- Triaged changed from No to Yes
- Sprint set to Sprint 73
Updated by fao89 over 4 years ago
- Status changed from NEW to ASSIGNED
- Assignee set to fao89
Updated by pulpbot over 4 years ago
- Status changed from ASSIGNED to POST
Added by Fabricio Aguiar over 4 years ago
Updated by Anonymous over 4 years ago
- Status changed from POST to MODIFIED
Applied in changeset cf88ced1889dae092a2da15e9629b3d4b5684688.
Added by Fabricio Aguiar over 4 years ago
Revision 0ecb0fdc | View on GitHub
Improving Content handler tests
https://pulp.plan.io/issues/6778 closes #6778 [nocoverage]
(cherry picked from commit cf88ced1889dae092a2da15e9629b3d4b5684688)
Updated by Anonymous over 4 years ago
Applied in changeset 0ecb0fdc3a96086fb4c75302018e0a42ce41eea0.
Updated by ttereshc over 4 years ago
- Status changed from MODIFIED to CLOSED - CURRENTRELEASE
Improving Content handler tests
https://pulp.plan.io/issues/6778 closes #6778 [nocoverage]