From d4d55e58684d5b8d03b3f4eb70bff3f104c5ddb5 Mon Sep 17 00:00:00 2001 From: Kevin Tian Date: Wed, 31 Jan 2024 12:44:58 -0500 Subject: [PATCH] Update flaky integration tests (#1359) --- test/integration/test_ibm_job.py | 2 +- test/integration/test_results.py | 32 --------------------------- test/integration/test_retrieve_job.py | 4 +++- 3 files changed, 4 insertions(+), 34 deletions(-) diff --git a/test/integration/test_ibm_job.py b/test/integration/test_ibm_job.py index 45e56fcc1..6ea5a2077 100644 --- a/test/integration/test_ibm_job.py +++ b/test/integration/test_ibm_job.py @@ -226,7 +226,7 @@ def test_retrieve_jobs_order(self): job = self.sim_backend.run(self.bell) job.wait_for_final_state() newest_jobs = self.service.jobs( - limit=10, + limit=20, pending=False, descending=True, created_after=self.last_month, diff --git a/test/integration/test_results.py b/test/integration/test_results.py index ad02a24da..6431e4a1d 100644 --- a/test/integration/test_results.py +++ b/test/integration/test_results.py @@ -21,7 +21,6 @@ from ..unit.mock.proxy_server import MockProxyServer, use_proxies from ..ibm_test_case import IBMIntegrationJobTestCase from ..decorators import run_integration_test -from ..utils import cancel_job_safe, wait_for_status class TestIntegrationResults(IBMIntegrationJobTestCase): @@ -199,37 +198,6 @@ def result_callback(job_id, result): self.assertEqual(iterations - 1, final_it) self.assertIsNotNone(job._ws_client._server_close_code) - @run_integration_test - def test_callback_cancel_job(self, service): - """Test canceling a running job while streaming results.""" - - def result_callback(job_id, result): - # pylint: disable=unused-argument - nonlocal final_it - if "iteration" in result: - final_it = result["iteration"] - - final_it = 0 - iterations = 5 - sub_tests = [JobStatus.QUEUED, JobStatus.RUNNING] - - for status in sub_tests: - with self.subTest(status=status): - if status == JobStatus.QUEUED: - _ = self._run_program(service) - - job = self._run_program( - service=service, - interim_results="foo", - callback=result_callback, - ) - wait_for_status(job, status) - if not cancel_job_safe(job, self.log): - return - time.sleep(3) # Wait for cleanup - self.assertIsNotNone(job._ws_client._server_close_code) - self.assertLess(final_it, iterations) - @skip("skip until qiskit-ibm-runtime #933 is fixed") @run_integration_test def test_websocket_proxy(self, service): diff --git a/test/integration/test_retrieve_job.py b/test/integration/test_retrieve_job.py index 222fff7f7..3af9528e8 100644 --- a/test/integration/test_retrieve_job.py +++ b/test/integration/test_retrieve_job.py @@ -184,7 +184,9 @@ def test_jobs_filter_by_date(self, service): job = self._run_program(service) job.wait_for_final_state() time_after_job = datetime.now(timezone.utc) - rjobs = service.jobs(created_before=time_after_job, created_after=current_time) + rjobs = service.jobs( + created_before=time_after_job, created_after=current_time, pending=False, limit=20 + ) self.assertTrue(job.job_id() in [j.job_id() for j in rjobs]) for job in rjobs: self.assertTrue(job.creation_date <= time_after_job)