From b2967fefa083be3ca6a355e0a783506bc55dceec Mon Sep 17 00:00:00 2001 From: Aron Fyodor Asor Date: Mon, 22 May 2017 18:44:02 -0700 Subject: [PATCH] add failing test for scheduling a lot of jobs at the same time. --- tests/common/test_classes.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/common/test_classes.py b/tests/common/test_classes.py index a308a0c5c7f..3ebbf4d275b 100644 --- a/tests/common/test_classes.py +++ b/tests/common/test_classes.py @@ -75,6 +75,7 @@ def test_schedule_runs_function(self, inmem_client, flag): # messaging backend. try: inmem_client._messaging.wait(mailbox=inmem_client.scheduler_mailbox_name, timeout=2) + inmem_client._messaging._wait_until_messages_processed() except queue.Empty: # Maybe it's been processed already... just continue anyway then. pass @@ -82,6 +83,15 @@ def test_schedule_runs_function(self, inmem_client, flag): job = inmem_client.status(job_id) assert job.state == Job.State.COMPLETED + def test_schedule_can_run_n_functions(self, inmem_client): + n = 10 + events = [Event() for _ in range(n)] + for e in events: + inmem_client.schedule(set_flag, e) + + for e in events: + assert e.wait(timeout=3) + def test_stringify_func_is_importable(self, client): funcstring = client.stringify_func(set_flag) func = client.import_stringified_func(funcstring)