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
This commit is contained in:
Clint Byrum
2016-12-05 10:52:07 -08:00
parent df0a55bbbd
commit 78a6977c34
3 changed files with 9 additions and 8 deletions

View File

@@ -3727,7 +3727,6 @@ For CI problems and help debugging, contact ci@example.org"""
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 @@ For CI problems and help debugging, contact ci@example.org"""
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:

View File

@@ -362,7 +362,8 @@ class LaunchServer(object):
data = {
'manager': self.hostname,
'url': 'https://server/job',
'url': 'https://server/job/{}/0/'.format(args['job']),
'worker_name': 'My Worker',
}
# TODOv3:

View File

@@ -161,10 +161,11 @@ class RPCListener(object):
# 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))