Merge pull request #1109 from DeterminateSystems/project-jobset/buildListColumns

buildListColumns: drop the project and jobset columns from the query
This commit is contained in:
Graham Christensen 2022-01-14 13:02:32 -05:00 committed by GitHub
commit 95eb14591f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 100 additions and 34 deletions

View file

@ -33,8 +33,7 @@ our @EXPORT = qw(
# Columns from the Builds table needed to render build lists.
Readonly::Array our @buildListColumns => ('id', 'finished', 'timestamp', 'stoptime', 'project', 'jobset', 'jobset_id', 'job', 'nixname', 'system', 'buildstatus', 'releasename');
Readonly::Array our @buildListColumns => ('id', 'finished', 'timestamp', 'stoptime', 'jobset_id', 'job', 'nixname', 'system', 'buildstatus', 'releasename');
sub getBuild {
my ($c, $id) = @_;

View file

@ -4,6 +4,7 @@ use Setup;
use Test2::V0;
use Catalyst::Test ();
use HTTP::Request::Common;
use JSON::MaybeXS qw(decode_json);
my $ctx = test_context();
@ -18,6 +19,11 @@ my $build = $builds->{"empty_dir"};
my $jobset = $build->jobset;
my $project = $build->project;
subtest "/job/PROJECT/JOBSET/JOB" => sub {
my $response = request(GET '/job/' . $project->name . '/' . $jobset->name . '/' . $build->job);
ok($response->is_success, "The page showing the job's overview data returns 200.");
};
subtest "/job/PROJECT/JOBSET/JOB/all" => sub {
my $response = request(GET '/job/' . $project->name . '/' . $jobset->name . '/' . $build->job . '/all');
ok($response->is_success, "The page showing the job's builds returns 200.");
@ -28,4 +34,27 @@ subtest "/job/PROJECT/JOBSET/JOB/channel/latest" => sub {
ok($response->is_success, "The page showing the job's channel returns 200.");
};
subtest "/job/PROJECT/JOBSET/JOB/shield" => sub {
my $response = request(GET '/job/' . $project->name . '/' . $jobset->name . '/' . $build->job . '/shield');
ok($response->is_success, "The page showing the job's shield returns 200.");
my $data;
my $valid_json = lives { $data = decode_json($response->content); };
ok($valid_json, "We get back valid JSON.");
if (!$valid_json) {
use Data::Dumper;
print STDERR Dumper $response->content;
}
is($data->{"color"}, "green");
is($data->{"label"}, "hydra build");
is($data->{"message"}, "passing");
is($data->{"schemaVersion"}, 1);
};
subtest "/job/PROJECT/JOBSET/JOB/prometheus" => sub {
my $response = request(GET '/job/' . $project->name . '/' . $jobset->name . '/' . $build->job . '/prometheus');
ok($response->is_success, "The page showing the job's prometheus data returns 200.");
};
done_testing;

View file

@ -22,7 +22,19 @@ my $jobset = createBaseJobset("basic", "basic.nix", $ctx{jobsdir});
ok(evalSucceeds($jobset), "Evaluating jobs/basic.nix should exit with return code 0");
my ($eval, @evals) = $jobset->jobsetevals;
subtest "Fetching the eval's overview" => sub {
my $fetch = request(GET '/eval/' . $eval->id);
is($fetch->code, 200, "eval page is 200");
};
subtest "Fetching the eval's overview" => sub {
my $fetch = request(GET '/eval/' . $eval->id . '/channel');
use Data::Dumper;
print STDERR Dumper $fetch->content;
is($fetch->code, 200, "channel page is 200");
};
done_testing;

View file

@ -1,30 +0,0 @@
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;

View file

@ -0,0 +1,56 @@
use strict;
use warnings;
use Setup;
use Data::Dumper;
use JSON::MaybeXS qw(decode_json);
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 queue runner status 200's.");
};
subtest "/queue" => sub {
my $response = request(GET '/queue', Accept => 'application/json');
ok($response->is_success, "The page showing the queue 200's.");
my $data;
my $valid_json = lives { $data = decode_json($response->content); };
ok($valid_json, "We get back valid JSON.");
if (!$valid_json) {
use Data::Dumper;
print STDERR Dumper $response->content;
}
};
subtest "/status" => sub {
my $response = request(GET '/status', Accept => 'application/json');
ok($response->is_success, "The page showing the status 200's.");
my $data;
my $valid_json = lives { $data = decode_json($response->content); };
ok($valid_json, "We get back valid JSON.");
if (!$valid_json) {
use Data::Dumper;
print STDERR Dumper $response->content;
}
};
done_testing;