diff --git a/t/Controller/Build/evals.t b/t/Controller/Build/evals.t new file mode 100644 index 00000000..f44d5733 --- /dev/null +++ b/t/Controller/Build/evals.t @@ -0,0 +1,33 @@ +use strict; +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"); +is(nrQueuedBuildsForJobset($jobset), 3, "Evaluating jobs/basic.nix should result in 3 builds"); +my ($build, @builds) = queuedBuildsForJobset($jobset); + +ok(runBuild($build), "Build '".$build->job."' from jobs/basic.nix should exit with code 0"); + +subtest "/build/ID/evals" => sub { + my $evals = request(GET '/build/' . $build->id . '/evals'); + ok($evals->is_success, "The page listing evaluations this build is part of returns 200."); +}; + +done_testing; diff --git a/t/Controller/Jobset/evals.t b/t/Controller/Jobset/evals.t new file mode 100644 index 00000000..ba53124a --- /dev/null +++ b/t/Controller/Jobset/evals.t @@ -0,0 +1,34 @@ +use strict; +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 "/jobset/PROJECT/JOBSET" => sub { + my $jobset = request(GET '/jobset/' . $project->name . '/' . $jobset->name); + ok($jobset->is_success, "The page showing the jobset returns 200."); +}; + +subtest "/jobset/PROJECT/JOBSET/evals" => sub { + my $jobsetevals = request(GET '/jobset/' . $project->name . '/' . $jobset->name . '/evals'); + ok($jobsetevals->is_success, "The page showing the jobset evals returns 200."); +}; + +done_testing; diff --git a/t/Controller/Root/evals.t b/t/Controller/Root/evals.t new file mode 100644 index 00000000..895ef424 --- /dev/null +++ b/t/Controller/Root/evals.t @@ -0,0 +1,29 @@ +use strict; +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 "/evals" => sub { + my $global = request(GET '/evals'); + ok($global->is_success, "The page showing the all evals returns 200."); +}; + +done_testing;