Update "make check" for the new queue runner

Also, if the machines file contains an entry for localhost, then run
"nix-store --serve" directly, without going through SSH.
This commit is contained in:
Eelco Dolstra
2015-06-25 15:29:22 +02:00
parent 32210905d8
commit 18a3c3ff1c
10 changed files with 54 additions and 45 deletions

View File

@ -1,6 +1,6 @@
TESTS_ENVIRONMENT = \
BZR_HOME="$(abs_builddir)/data" \
HYDRA_DBI="dbi:SQLite:db.sqlite" \
HYDRA_DBI="dbi:Pg:dbname=hydra-test-suite;" \
HYDRA_DATA="$(abs_builddir)/data" \
HYDRA_HOME="$(top_srcdir)/src" \
HYDRA_CONFIG= \
@ -22,15 +22,11 @@ EXTRA_DIST = \
$(TESTS)
TESTS = \
query-all-tables.pl \
evaluation-tests.pl
set-up.pl \
evaluation-tests.pl \
tear-down.pl
clean:
chmod -R a+w nix || true
rm -rf db.sqlite data nix git-repo hg-repo svn-repo svn-checkout svn-checkout-repo bzr-repo bzr-checkout-repo darcs-repo
rm -f .*-state
check_SCRIPTS = db.sqlite repos
check_SCRIPTS = repos
db.sqlite: $(top_srcdir)/src/sql/hydra-sqlite.sql
$(TESTS_ENVIRONMENT) $(top_srcdir)/src/script/hydra-init

View File

@ -71,8 +71,7 @@ sub evalSucceeds {
sub runBuild {
my ($build) = @_;
my ($res, $stdout, $stderr) = captureStdoutStderr(60, ("hydra-build", $build->id));
print "STDERR: $stderr" if $stderr ne "";
my ($res, $stdout, $stderr) = captureStdoutStderr(60, ("hydra-queue-runner", "-vvvv", "--build-one", $build->id));
return !$res;
}

2
tests/evaluation-tests.pl Executable file → Normal file
View File

@ -28,7 +28,7 @@ ok(nrQueuedBuildsForJobset($jobset) == 3 , "Evaluating jobs/basic.nix should res
for my $build (queuedBuildsForJobset($jobset)) {
ok(runBuild($build), "Build '".$build->job->name."' from jobs/basic.nix should exit with code 0");
my $newbuild = $db->resultset('Builds')->find($build->id);
my $expected = $build->job->name eq "fails" ? 1 : 0;
my $expected = $build->job->name eq "fails" ? 1 : $build->job->name =~ /with_failed/ ? 6 : 0;
ok($newbuild->finished == 1 && $newbuild->buildstatus == $expected, "Build '".$build->job->name."' from jobs/basic.nix should have buildstatus $expected");
}

View File

@ -1,21 +0,0 @@
use strict;
use Hydra::Schema;
use Hydra::Model::DB;
my $db = Hydra::Model::DB->new;
my @sources = $db->schema->sources;
my $nrtables = scalar(@sources);
use Test::Simple tests => 38;
foreach my $source (@sources) {
my $title = "Basic select query for $source";
if ($source eq "SchemaVersion" || $source eq "NrBuilds") {
ok(scalar($db->resultset($source)->all) == 1, $title);
} elsif( $source !~ m/^LatestSucceeded/) {
ok(scalar($db->resultset($source)->all) == 0, $title);
} else {
ok(scalar($db->resultset($source)->search({},{ bind => ["", "", ""] })) == 0, $title);
}
}

0
tests/s3-backup-test.pl Executable file → Normal file
View File

3
tests/set-up.pl Normal file
View File

@ -0,0 +1,3 @@
use strict;
system("createdb hydra-test-suite") == 0 or die;
system("hydra-init") == 0 or die;

5
tests/tear-down.pl Normal file
View File

@ -0,0 +1,5 @@
use strict;
system("chmod -R a+w nix") == 0 or die;
system("rm -rf data nix git-repo hg-repo svn-repo svn-checkout svn-checkout-repo bzr-repo bzr-checkout-repo darcs-repo") == 0 or die;
system("rm -f .*-state") == 0 or die;
system("dropdb hydra-test-suite") == 0 or die;