From fa62c8b7f2ea3f6f14effe50321f4315a9835314 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 13 Mar 2012 13:18:40 +0100 Subject: [PATCH] Fix tests --- tests/Setup.pm | 4 +++- tests/evaluation-tests.pl | 5 ++--- tests/query-all-tables.pl | 9 ++++----- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/Setup.pm b/tests/Setup.pm index 87d1f28a..549066a5 100644 --- a/tests/Setup.pm +++ b/tests/Setup.pm @@ -3,6 +3,7 @@ package Setup; use strict; use Exporter; use Hydra::Helper::Nix; +use Hydra::Model::DB; use Hydra::Helper::AddBuilds; use Cwd; @@ -32,7 +33,8 @@ sub nrQueuedBuildsForJobset { sub createBaseJobset { my ($jobsetName, $nixexprpath) = @_; - my $project = openHydraDB->resultset('Projects')->update_or_create({name => "tests", displayname => "", owner => "root"}); + my $db = Hydra::Model::DB->new; + my $project = $db->resultset('Projects')->update_or_create({name => "tests", displayname => "", owner => "root"}); my $jobset = $project->jobsets->create({name => $jobsetName, nixexprinput => "jobs", nixexprpath => $nixexprpath, emailoverride => ""}); my $jobsetinput; diff --git a/tests/evaluation-tests.pl b/tests/evaluation-tests.pl index fff89c3f..26510000 100755 --- a/tests/evaluation-tests.pl +++ b/tests/evaluation-tests.pl @@ -1,12 +1,11 @@ use strict; use Hydra::Schema; -use Hydra::Helper::Nix; +use Hydra::Model::DB; use Hydra::Helper::AddBuilds; use Cwd; - use Setup; -my $db = openHydraDB; +my $db = Hydra::Model::DB->new; use Test::Simple tests => 28; diff --git a/tests/query-all-tables.pl b/tests/query-all-tables.pl index 1475f173..96893ba9 100755 --- a/tests/query-all-tables.pl +++ b/tests/query-all-tables.pl @@ -1,10 +1,10 @@ use strict; use Hydra::Schema; -use Hydra::Helper::Nix; +use Hydra::Model::DB; -my $db = openHydraDB; +my $db = Hydra::Model::DB->new; -my @sources = $db->sources; +my @sources = $db->schema->sources; my $nrtables = scalar(@sources); use Test::Simple tests => 42; @@ -15,8 +15,7 @@ foreach my $source (@sources) { ok(scalar($db->resultset($source)->all) == 1, $title); } elsif( $source !~ m/^(LatestSucceeded|JobStatus|ActiveJobs)/) { ok(scalar($db->resultset($source)->all) == 0, $title); - } - else { + } else { ok(scalar($db->resultset($source)->search({},{ bind => ["", "", ""] })) == 0, $title); } }