queue-runner-status: fixup from perlcritic-level-2

>
> from_json was legacy / deprecated. This was the only use.
This commit is contained in:
Graham Christensen 2021-12-15 17:22:11 -05:00
parent 42f0dee441
commit f2f8d571f3
2 changed files with 31 additions and 1 deletions

View file

@ -168,7 +168,7 @@ sub queue_runner_status_GET {
my ($self, $c) = @_;
#my $status = from_json($c->model('DB::SystemStatus')->find('queue-runner')->status);
my $status = from_json(`hydra-queue-runner --status`);
my $status = decode_json(`hydra-queue-runner --status`);
if ($?) { $status->{status} = "unknown"; }
my $json = JSON->new->pretty()->canonical();

View file

@ -0,0 +1,30 @@
use strict;
use warnings;
use Setup;
use Data::Dumper;
my %ctx = test_init();
require Hydra::Schema;
require Hydra::Model::DB;
require Hydra::Helper::Nix;
use Test2::V0;
require Catalyst::Test;
use HTTP::Request::Common;
Catalyst::Test->import('Hydra');
my $db = Hydra::Model::DB->new;
hydra_setup($db);
my $project = $db->resultset('Projects')->create({name => "tests", displayname => "", owner => "root"});
my $jobset = createBaseJobset("basic", "basic.nix", $ctx{jobsdir});
ok(evalSucceeds($jobset), "Evaluating jobs/basic.nix should exit with return code 0");
subtest "/queue-runner-status" => sub {
my $global = request(GET '/queue-runner-status');
ok($global->is_success, "The page showing the the queue runner status 200's.");
};
done_testing;