robottelo icon indicating copy to clipboard operation
robottelo copied to clipboard

tests/foreman/api/test_repository.py::RepositoryTestCase::test_module_stream_repository_crud_operations failing with timeout issue

Open vijay8451 opened this issue 5 years ago • 1 comments

tests/foreman/api/test_repository.py::RepositoryTestCase::test_module_stream_repository_crud_operations

self = <tests.foreman.api.test_repository.RepositoryTestCase testMethod=test_module_stream_repository_crud_operations>

    @tier1
    @upgrade
    def test_module_stream_repository_crud_operations(self):
        """Verify that module stream api calls works with product having other type
        repositories.
    
        :id: 61a5d24e-d4da-487d-b6ea-9673c05ceb60
    
        :expectedresults: module stream repo create, update, delete api calls should work with
         count of module streams
    
        :CaseImportance: Critical
        """
        repository = entities.Repository(
            url=CUSTOM_MODULE_STREAM_REPO_2,
            content_type=REPO_TYPE['yum'],
            product=self.product,
            unprotected=False,
        ).create()
        repository.sync()
        self.assertEquals(repository.read().content_counts['module_stream'], 7)
        repository.url = CUSTOM_MODULE_STREAM_REPO_1
        repository = repository.update(['url'])
> repository.sync()

tests/foreman/api/test_repository.py:1285:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.env/lib64/python3.7/site-packages/nailgun/entities.py:6230: in sync
    return _handle_response(response, self._server_config, synchronous)
.env/lib64/python3.7/site-packages/nailgun/entities.py:121: in _handle_response
    server_config, id=response.json()['id']).poll(timeout=timeout)
.env/lib64/python3.7/site-packages/nailgun/entities.py:3314: in poll
    timeout
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

    def _poll_task(task_id, server_config, poll_rate=None, timeout=None):
        """Implement :meth:`nailgun.entities.ForemanTask.poll`.
    
        See :meth:`nailgun.entities.ForemanTask.poll` for a full description of how
        this method acts. Other methods may also call this method, such as
        :meth:`nailgun.entity_mixins.EntityDeleteMixin.delete`.
    
        Certain mixins benefit from being able to poll the server after performing
        an operation. However, this module cannot use
        :meth:`nailgun.entities.ForemanTask.poll`, as that would be a circular
        import. Placing the implementation of
        :meth:`nailgun.entities.ForemanTask.poll` here allows both that method and
        the mixins in this module to use the same logic.
    
        """
        if poll_rate is None:
            poll_rate = TASK_POLL_RATE
        if timeout is None:
            timeout = TASK_TIMEOUT
    
        # Implement the timeout.
        def raise_task_timeout(): # pragma: no cover
            """Raise a KeyboardInterrupt exception in the main thread."""
            thread.interrupt_main()
    
        timer = threading.Timer(timeout, raise_task_timeout)
    
        # Poll until the task finishes. The timeout prevents an infinite loop.
        path = '{0}/foreman_tasks/api/tasks/{1}'.format(server_config.url, task_id)
        try:
            timer.start()
            while True:
                response = client.get(path, **server_config.get_client_kwargs())
                response.raise_for_status()
                task_info = response.json()
                if task_info['state'] in ('paused', 'stopped'):
                    break
                time.sleep(poll_rate)
        except KeyboardInterrupt: # pragma: no cover
            # raise_task_timeout will raise a KeyboardInterrupt when the timeout
            # expires. Catch the exception and raise TaskTimedOutError
            raise TaskTimedOutError(
                'Timed out polling task {0}. Task information: {1}'
> .format(task_id, task_info)
            )
E nailgun.entity_mixins.TaskTimedOutError: Timed out polling task 8cbbe2d8-072d-4940-bbd2-d7357e43a414. Task information: {'id': '8cbbe2d8-072d-4940-bbd2-d7357e43a414', 'label': 'Actions::Katello::Repository::Sync', 'pending': True, 'action': "Synchronize repository 'IqLugXoVxiB'; product 'OdzlZmMGGf'; organization 'wFOKuAzM'", 'username': 'admin', 'started_at': '2019-11-26 09:55:58 UTC', 'ended_at': None, 'state': 'running', 'result': 'pending', 'progress': 0.5, 'input': {'repository': {'id': 75, 'name': 'IqLugXoVxiB', 'label': 'IqLugXoVxiB'}, 'product': {'id': 1074, 'name': 'OdzlZmMGGf', 'label': 'OdzlZmMGGf', 'cp_id': '365191657152'}, 'provider': {'id': 547, 'name': 'Anonymous'}, 'organization': {'id': 385, 'name': 'wFOKuAzM', 'label': 'wFOKuAzM'}, 'id': 75, 'sync_result': {'class': 'Dynflow::ExecutionPlan::OutputReference', 'execution_plan_id': '70b9fe90-fe14-49de-8015-5c32e2187cbd', 'step_id': 6, 'action_id': 2, 'subkeys': []}, 'skip_metadata_check': False, 'validate_contents': False, 'contents_changed': {'class': 'Dynflow::ExecutionPlan::OutputReference', 'execution_plan_id': '70b9fe90-fe14-49de-8015-5c32e2187cbd', 'step_id': 6, 'action_id': 2, 'subkeys': ['contents_changed']}, 'current_request_id': None, 'current_timezone': 'UTC', 'current_user_id': 4, 'current_organization_id': None, 'current_location_id': None}, 'output': {}, 'humanized': {'action': 'Synchronize', 'input': [['repository', {'text': "repository 'IqLugXoVxiB'", 'link': None}], ['product', {'text': "product 'OdzlZmMGGf'", 'link': '/products/1074/'}], ['organization', {'text': "organization 'wFOKuAzM'", 'link': '/organizations/385/edit'}]], 'output': 'New packages: 1295 (1.58 GB).', 'errors': []}, 'cli_example': None, 'available_actions': {'cancellable': False, 'resumable': False}}

.env/lib64/python3.7/site-packages/nailgun/entity_mixins.py:106: TaskTimedOutError

vijay8451 avatar Nov 29 '19 09:11 vijay8451

@vijay8451 can you give this issue a more descriptive title?

JacobCallahan avatar Dec 02 '19 21:12 JacobCallahan