Re-enable test_client_get_running_jobs
In coercing this test to run, it's clear there are a number of "TODO"
items in zuul.launcher.server.LaunchServer that seem simple enough but
that I don't really understand. I've filled in enough to make the test
pass, but I am not at all confident that this is actually the way we
want this to work long-term.
get_running_jobs also had to be extended to add tenants. I have to
wonder if we should change the payload to return the tenants somehow.
Change-Id: If91cb662ceef8e1d7660974df07b821720f210d4
Story: 2000773
Task: 3414
diff --git a/tests/test_scheduler.py b/tests/test_scheduler.py
index d01a88d..75d6e35 100755
--- a/tests/test_scheduler.py
+++ b/tests/test_scheduler.py
@@ -3727,7 +3727,6 @@
self.launch_server.release()
self.waitUntilSettled()
- @skip("Disabled for early v3 development")
def test_client_get_running_jobs(self):
"Test that the RPC client can get a list of running jobs"
self.launch_server.hold_jobs_in_build = True
@@ -3745,7 +3744,7 @@
if time.time() - start > 10:
raise Exception("Timeout waiting for gearman server to report "
+ "back to the client")
- build = self.launcher.builds.values()[0]
+ build = self.launch_client.builds.values()[0]
if build.worker.name == "My Worker":
break
else:
diff --git a/zuul/launcher/server.py b/zuul/launcher/server.py
index b831107..74cc2be 100644
--- a/zuul/launcher/server.py
+++ b/zuul/launcher/server.py
@@ -362,7 +362,8 @@
data = {
'manager': self.hostname,
- 'url': 'https://server/job',
+ 'url': 'https://server/job/{}/0/'.format(args['job']),
+ 'worker_name': 'My Worker',
}
# TODOv3:
diff --git a/zuul/rpclistener.py b/zuul/rpclistener.py
index 90e17dc..c780df4 100644
--- a/zuul/rpclistener.py
+++ b/zuul/rpclistener.py
@@ -161,10 +161,11 @@
# args = json.loads(job.arguments)
# TODO: use args to filter by pipeline etc
running_items = []
- for pipeline_name, pipeline in six.iteritems(
- self.sched.layout.pipelines):
- for queue in pipeline.queues:
- for item in queue.queue:
- running_items.append(item.formatJSON())
+ for tenant in self.sched.abide.tenants.values():
+ for pipeline_name, pipeline in six.iteritems(
+ tenant.layout.pipelines):
+ for queue in pipeline.queues:
+ for item in queue.queue:
+ running_items.append(item.formatJSON())
job.sendWorkComplete(json.dumps(running_items))