From da516f70a4f10efa8ab2e91a0e735a1d43643086 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Fri, 14 Jan 2022 15:19:41 -0500 Subject: [PATCH 1/4] queue summary: test --- t/Hydra/Controller/Root/status.t | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/t/Hydra/Controller/Root/status.t b/t/Hydra/Controller/Root/status.t index 94aa17b0..6b68976a 100644 --- a/t/Hydra/Controller/Root/status.t +++ b/t/Hydra/Controller/Root/status.t @@ -28,6 +28,11 @@ subtest "/queue-runner-status" => sub { ok($global->is_success, "The page showing the queue runner status 200's."); }; +subtest "/queue-summary" => sub { + my $response = request(GET '/queue-summary'); + ok($response->is_success, "The page showing the queue summary 200's."); +}; + subtest "/queue" => sub { my $response = request(GET '/queue', Accept => 'application/json'); ok($response->is_success, "The page showing the queue 200's."); From c945529f052bab9f6eea5089581e3979faab8c51 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Sun, 9 Jan 2022 11:40:17 -0500 Subject: [PATCH 2/4] queue summary: fix refs --- src/lib/Hydra/Controller/Root.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lib/Hydra/Controller/Root.pm b/src/lib/Hydra/Controller/Root.pm index 2745d0c2..587f4495 100644 --- a/src/lib/Hydra/Controller/Root.pm +++ b/src/lib/Hydra/Controller/Root.pm @@ -136,8 +136,9 @@ sub queue_summary :Local :Path('queue-summary') :Args(0) { $c->stash->{template} = 'queue-summary.tt'; $c->stash->{queued} = dbh($c)->selectall_arrayref( - "select project, jobset, count(*) as queued, min(timestamp) as oldest, max(timestamp) as newest from Builds " . - "where finished = 0 group by project, jobset order by queued desc", + "select jobsets.project as project, jobsets.name as jobset, count(*) as queued, min(timestamp) as oldest, max(timestamp) as newest from Builds " . + "join Jobsets jobsets on jobsets.id = builds.jobset_id " . + "where finished = 0 group by jobsets.project, jobsets.name order by queued desc", { Slice => {} }); $c->stash->{systems} = dbh($c)->selectall_arrayref( From bdccad573c7ba6b78d9126c7a8af3cf40ea2b5a1 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Fri, 14 Jan 2022 15:19:46 -0500 Subject: [PATCH 3/4] machines: test --- t/Hydra/Controller/Root/status.t | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/t/Hydra/Controller/Root/status.t b/t/Hydra/Controller/Root/status.t index 6b68976a..1b53583e 100644 --- a/t/Hydra/Controller/Root/status.t +++ b/t/Hydra/Controller/Root/status.t @@ -23,6 +23,11 @@ my $jobset = createBaseJobset("basic", "basic.nix", $ctx{jobsdir}); ok(evalSucceeds($jobset), "Evaluating jobs/basic.nix should exit with return code 0"); +subtest "/machines" => sub { + my $response = request(GET '/machines'); + ok($response->is_success, "The page showing the machine status 200's."); +}; + subtest "/queue-runner-status" => sub { my $global = request(GET '/queue-runner-status'); ok($global->is_success, "The page showing the queue runner status 200's."); From 8a663f2cf8a4460b9b47e88bdd0fe3c8d0e8a21c Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Sun, 9 Jan 2022 11:40:24 -0500 Subject: [PATCH 4/4] machines: fixup refs --- src/lib/Hydra/Controller/Root.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/lib/Hydra/Controller/Root.pm b/src/lib/Hydra/Controller/Root.pm index 587f4495..c02602f3 100644 --- a/src/lib/Hydra/Controller/Root.pm +++ b/src/lib/Hydra/Controller/Root.pm @@ -200,8 +200,10 @@ sub machines :Local Args(0) { $c->stash->{machines} = $machines; $c->stash->{steps} = dbh($c)->selectall_arrayref( - "select build, stepnr, s.system as system, s.drvpath as drvpath, machine, s.starttime as starttime, project, jobset, job, s.busy as busy " . - "from BuildSteps s join Builds b on s.build = b.id " . + "select build, stepnr, s.system as system, s.drvpath as drvpath, machine, s.starttime as starttime, jobsets.project, jobsets.name, job, s.busy as busy " . + "from BuildSteps s " . + "join Builds b on s.build = b.id " . + "join Jobsets jobsets on jobsets.id = b.jobset_id " . "where busy != 0 order by machine, stepnr", { Slice => {} }); $c->stash->{template} = 'machine-status.tt';