Project

Profile

Help

Issue #6778

closed

content handler test fails every now and then

Added by ttereshc about 2 years ago. Updated almost 2 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Assignee:
Sprint/Milestone:
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Version:
Platform Release:
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Sprint:
Sprint 74
Quarter:

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
Actions #1

Updated by dkliban@redhat.com about 2 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.

Actions #2

Updated by ttereshc about 2 years ago

  • Triaged changed from No to Yes
  • Sprint set to Sprint 73
Actions #3

Updated by fao89 about 2 years ago

  • Status changed from NEW to ASSIGNED
  • Assignee set to fao89
Actions #4

Updated by pulpbot about 2 years ago

  • Status changed from ASSIGNED to POST

Added by Fabricio Aguiar about 2 years ago

Revision cf88ced1

Improving Content handler tests

https://pulp.plan.io/issues/6778 closes #6778 [nocoverage]

Actions #5

Updated by rchan about 2 years ago

  • Sprint changed from Sprint 73 to Sprint 74
Actions #6

Updated by Anonymous about 2 years ago

  • Status changed from POST to MODIFIED

Added by Fabricio Aguiar about 2 years ago

Revision 0ecb0fdc

Improving Content handler tests

https://pulp.plan.io/issues/6778 closes #6778 [nocoverage]

(cherry picked from commit cf88ced1889dae092a2da15e9629b3d4b5684688)

Actions #7

Updated by Anonymous about 2 years ago

Actions #8

Updated by ttereshc almost 2 years ago

  • Sprint/Milestone set to Pulp RPM 3.4.2
Actions #9

Updated by ttereshc almost 2 years ago

  • Status changed from MODIFIED to CLOSED - CURRENTRELEASE

Also available in: Atom PDF