hydra/tests/query-all-tables.pl

22 lines
634 B
Perl
Raw Normal View History

2011-03-16 08:50:31 +00:00
use strict;
use Hydra::Schema;
2012-03-13 12:18:40 +00:00
use Hydra::Model::DB;
2011-03-16 08:50:31 +00:00
2012-03-13 12:18:40 +00:00
my $db = Hydra::Model::DB->new;
2011-03-16 08:50:31 +00:00
2012-03-13 12:18:40 +00:00
my @sources = $db->schema->sources;
2011-03-16 08:50:31 +00:00
my $nrtables = scalar(@sources);
2013-02-05 18:50:58 +00:00
use Test::Simple tests => 45;
2011-03-16 08:50:31 +00:00
foreach my $source (@sources) {
2013-01-23 12:48:02 +00:00
my $title = "Basic select query for $source";
if ($source eq "SchemaVersion" || $source eq "NrBuilds") {
2013-01-23 12:48:02 +00:00
ok(scalar($db->resultset($source)->all) == 1, $title);
2013-08-20 13:22:46 +00:00
} elsif( $source !~ m/^(LatestSucceeded|JobStatus)/) {
2013-01-23 12:48:02 +00:00
ok(scalar($db->resultset($source)->all) == 0, $title);
} else {
ok(scalar($db->resultset($source)->search({},{ bind => ["", "", ""] })) == 0, $title);
}
2011-03-16 08:50:31 +00:00
}