GLJD3PG2EYSB7EWYWEU57TYJQB6VDP2CJF6OLFEFIWZAY7OBXMMAC
4YCF3KBGI4VYKHJXAREJLCJLY3UWB2FX447CJ4XQWFRKRFKG5WCQC
QHOKZZUCFAI6ETEHCM2TO4P5ZMBSRR25MT55JVIGX3G5SHTXC3UQC
TZEDUWFXDA4O6ZVE7VC5TYSOPRVVSSSLUG3BERASO2KGHIWZZL3AC
KSFJOFICNKAPJPEAD2BHLHXEKU3PQIBL4LL2IK3ONY6KJDXQZPVAC
LZVO64YG43JD7YMZSCTZNOBS5ROZA4FMPKJW2YOMHX2V5PTGBVWQC
SYLVCTT64DMSUBWROO5USFBSK2OCNB2NB72SSGM4MOEHMUQONEPQC
YI3BZG5NWMKBT7T2HEOHVHSZBQ5KPDWSI3VRYOMQ346LRFB4MR2AC
4VYSDP4IAWIIVLXCKXJEYWIHZV3PUD3VACX3K4EIQKPFGWLZK6HQC
Q3VTDUSQ75JD5L55VWQV6MGAS6IC4AWGSADL2ISMX5E7R3LBVBHAC
MIMHJSZKFRNIKCYWQQDITZFPY6L2P43BSBPFERK3633CFDQY7YDAC
use Test::Simple tests => 20;
use File::Copy;
my %ctx = test_init(
hydra_config => q|
# No caching for PathInput plugin, otherwise we get wrong values
# (as it has a 30s window where no changes to the file are considered).
path_input_cache_validity_seconds = 0
|
);
my $jobsetdir = $ctx{tmpdir} . '/jobset';
mkdir($jobsetdir);
copy($ctx{jobsdir} . '/api-test.nix', "$jobsetdir/default.nix");
require Hydra::Schema;
use HTTP::Request::Common;
use Test2::V0;
require Catalyst::Test;
Catalyst::Test->import('Hydra');
my $db = Hydra::Model::DB->new;
hydra_setup($db);
{
my $user = $db->resultset('Users')->find({ username => 'root' });
$user->setPassword('foobar');
$user->userroles->update_or_create({ role => 'admin' });
}
$result = request_json({ uri => '/jobset/sample/default', method => 'PUT', data => { nixexprpath => "default.nix", nixexprinput => "my-src", inputs => { "my-src" => { type => "path", value => "/run/jobset" } }, enabled => "1", visible => "1", checkinterval => "3600"} });
$result = request_json({ uri => '/jobset/sample/default', method => 'PUT', data => { nixexprpath => "default.nix", nixexprinput => "my-src", inputs => { "my-src" => { type => "path", value => $jobsetdir } }, enabled => "1", visible => "1", checkinterval => "3600"} });
system("echo >> /run/jobset/default.nix; hydra-eval-jobset sample default");
open(my $fh, ">>", "${jobsetdir}/default.nix") or die "didn't open?";
say $fh "\n";
close $fh;
ok(evalSucceeds($db->resultset('Jobsets')->find({ name => 'default' })), "Evaluating should exit with return code 0");
ok($build->{buildoutputs}->{out}->{path} =~ /^\/nix\/store\/[a-zA-Z0-9]{32}-job$/, "The build's outpath is in the Nix store and named 'job'");
ok($build->{buildoutputs}->{out}->{path} =~ /\/nix\/store\/[a-zA-Z0-9]{32}-job$/, "The build's outpath is in the Nix store and named 'job'");
done_testing;