Merge pull request #939 from regnat/include-localhost-features
Include localhost's features in the default machine file
This commit is contained in:
commit
8d6a5aac84
|
@ -156,7 +156,8 @@ void State::monitorMachinesFile()
|
|||
if (machinesFiles.empty()) {
|
||||
parseMachines("localhost " +
|
||||
(settings.thisSystem == "x86_64-linux" ? "x86_64-linux,i686-linux" : settings.thisSystem.get())
|
||||
+ " - " + std::to_string(settings.maxBuildJobs) + " 1");
|
||||
+ " - " + std::to_string(settings.maxBuildJobs) + " 1 "
|
||||
+ concatStringsSep(",", settings.systemFeatures.get()));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,5 @@ dirs:
|
|||
touch data/hydra.conf
|
||||
mkdir -p nix
|
||||
mkdir -p nix/etc/nix
|
||||
touch nix/etc/nix/nix.conf
|
||||
echo "sandbox = false" >> nix/etc/nix/nix.conf
|
||||
mkdir -p nix/store
|
||||
mkdir -p nix/var
|
||||
|
|
30
t/default-machine-file.t
Normal file
30
t/default-machine-file.t
Normal file
|
@ -0,0 +1,30 @@
|
|||
use feature 'unicode_strings';
|
||||
use strict;
|
||||
use Setup;
|
||||
|
||||
my %ctx = test_init();
|
||||
|
||||
require Hydra::Schema;
|
||||
require Hydra::Model::DB;
|
||||
|
||||
use Test2::V0;
|
||||
|
||||
my $db = Hydra::Model::DB->new;
|
||||
hydra_setup($db);
|
||||
|
||||
my $project = $db->resultset('Projects')->create({name => "tests", displayname => "", owner => "root"});
|
||||
|
||||
my $jobset = createBaseJobset("default-machine-file", "default-machine-file.nix", $ctx{jobsdir});
|
||||
|
||||
ok(evalSucceeds($jobset), "Evaluating jobs/default-machine-file.nix should exit with return code 0");
|
||||
is(nrQueuedBuildsForJobset($jobset), 1, "Evaluating jobs/default-machine-file.nix should result in 1 build");
|
||||
|
||||
for my $build (queuedBuildsForJobset($jobset)) {
|
||||
ok(runBuild($build), "Build '".$build->job."' from jobs/default-machine-file.nix should exit with code 0");
|
||||
my $newbuild = $db->resultset('Builds')->find($build->id);
|
||||
is($newbuild->finished, 1, "Build '".$build->job."' from jobs/default-machine-file.nix should be finished.");
|
||||
my $expected = $build->job eq "fails" ? 1 : $build->job =~ /with_failed/ ? 6 : 0;
|
||||
is($newbuild->buildstatus, $expected, "Build '".$build->job."' from jobs/default-machine-file.nix should have buildstatus $expected.");
|
||||
}
|
||||
|
||||
done_testing;
|
9
t/jobs/default-machine-file.nix
Normal file
9
t/jobs/default-machine-file.nix
Normal file
|
@ -0,0 +1,9 @@
|
|||
with import ./config.nix;
|
||||
{
|
||||
requireExperimentalFeatures =
|
||||
mkDerivation {
|
||||
name = "empty-dir";
|
||||
builder = ./empty-dir-builder.sh;
|
||||
requiredSystemFeatures = [ "test-system-feature" ];
|
||||
};
|
||||
}
|
|
@ -48,6 +48,7 @@ sub test_init {
|
|||
my $nixconf = "$ENV{'NIX_CONF_DIR'}/nix.conf";
|
||||
open(my $fh, '>', $nixconf) or die "Could not open file '$nixconf' $!";
|
||||
print $fh "sandbox = false\n";
|
||||
print $fh "system-features = test-system-feature\n";
|
||||
print $fh $opts{'nix_config'} || "";
|
||||
close $fh;
|
||||
|
||||
|
|
Loading…
Reference in a new issue