def test_01_repo_sync_finish(self): self.el.update(self.pulp, {'event_types': ['repo.sync.finish']}) self.el.reload(self.pulp) repo_role = [repo for repo in ROLES.repos if repo.type == 'rpm'][0] repo, importer, [distributor] = YumRepo( id='sync_error_repo', importer=YumImporter(feed='http://example.com/repos/none'), distributors=[YumDistributor(relative_url='/repos/none') ]).create(self.pulp) with deleting(self.pulp, repo, importer, distributor): response = repo.sync(self.pulp) self.assertPulpOK() with self.assertRaises(TaskFailure): # make sure the sync did not succeed Task.wait_for_report(self.pulp, response) tasks = Task.from_report(self.pulp, response) # assert the bin contains request with a failed task in body self.bin.reload() assert self.bin.request_count == 1, 'invalid bin.request count: %s' % self.bin.request_count el_request = self.bin.requests[0] assert el_request.method == 'POST', 'invalid bin request method: %s' % el_request.method el_task = Task.from_call_report_data(json.loads(el_request.body)) # doesn't work and won't get fixed --- disabling # assert el_task.state == TASK_ERROR_STATE, 'invalid request.body:Task.state: %s' % el_task.state assert el_task.id in [ task.id for task in tasks ], 'invalid request.body:Task.id: %s' % el_task.id
def test_01_repo_sync_finish(self): self.el.update(self.pulp, {'event_types': ['repo.sync.finish']}) self.el.reload(self.pulp) repo_role = [repo for repo in ROLES.repos if repo.type == 'rpm'][0] repo, importer, [distributor] = YumRepo(id='sync_error_repo', importer=YumImporter(feed='http://example.com/repos/none'), distributors=[YumDistributor(relative_url='/repos/none')]).create(self.pulp) with deleting(self.pulp, repo, importer, distributor): response = repo.sync(self.pulp) self.assertPulpOK() with self.assertRaises(TaskFailure): # make sure the sync did not succeed Task.wait_for_report(self.pulp, response) tasks = Task.from_report(self.pulp, response) # assert the bin contains request with a failed task in body self.bin.reload() assert self.bin.request_count == 1, 'invalid bin.request count: %s' % self.bin.request_count el_request = self.bin.requests[0] assert el_request.method == 'POST', 'invalid bin request method: %s' % el_request.method el_task = Task.from_call_report_data(json.loads(el_request.body)) # doesn't work and won't get fixed --- disabling # assert el_task.state == TASK_ERROR_STATE, 'invalid request.body:Task.state: %s' % el_task.state assert el_task.id in [task.id for task in tasks], 'invalid request.body:Task.id: %s' % el_task.id