Fixups for the tests. I moved the nested key checking into a TODO block. I'm

not sure how to handle them, as they may / may not exist in the %output hash.
Sometimes they'll pass, sometimes they won't, depending upon the time you run
it and the status of Spectre overall.
This commit is contained in:
Chris Nehren 2007-11-02 19:12:16 +00:00
parent 3e2bad5cb4
commit dd53243b08
2 changed files with 22 additions and 17 deletions

View file

@ -11,7 +11,8 @@
use FindBin;
use strict;
use lib "$FindBin::Bin/../lib", "/data/wre/lib";
use warnings;
use lib "$FindBin::Bin/../lib", "../../wre/lib";
use WebGUI::Test;
use WebGUI::Session;
use Spectre::Admin;
@ -42,8 +43,9 @@ my $spectreConfig = Config::JSON->new($spectreConfigFile);
my $ip = $spectreConfig->get('ip');
my $port = $spectreConfig->get('port');
# put your tests here
# need to declare these before the skip block so that they're also visible in
# the todo block
my ($structure, $sitename);
SKIP: {
skip "need modperl, modproxy, and spectre running to test", 10 unless ($isModPerlRunning && $isModProxyRunning && $isSpectreRunning);
# XXX kinda evil kludge to put an activity in the scheduler so that the
@ -70,16 +72,20 @@ SKIP: {
ok(defined $result, 'can call getJsonStatus');
$remote->disconnect;
undef $remote;
my $structure;
ok($structure = jsonToObj($result), 'workflow/getJsonStatus returns a proper JSON data structure');
diag(Dumper $structure);
cmp_ok(ref $structure, 'eq', 'HASH', 'workflow/getJsonStatus returns a JSON structure parseable into a Perl hashref');
my $sitename = $session->config->get('sitename')->[0];
$sitename = $session->config->get('sitename')->[0];
ok(exists $structure->{$sitename}, "$sitename exists in returned structure");
for my $key(qw/Suspended Waiting Running/) {
ok(exists $structure->{$sitename}{$key}, "$key exists for $sitename");
cmp_ok(ref $structure->{$sitename}{$key}, 'eq', 'HASH', "$key is a hashref in the $sitename hash");
}
}
# Not sure how to handle these; the problem is that there may or may not be
# items in each queue type, and specifically constructing each key for each
# sitename in getJsonStatus even though they may not have data seems a bit
# contrived and kludgish.
TODO: {
local $TODO = "tests to make later.";
for my $key(qw/Suspended Waiting Running/) {
ok(exists $structure->{$sitename}{$key}, "$key exists for $sitename");
cmp_ok(ref $structure->{$sitename}{$key}, 'eq', 'ARRAY', "$key is an arrayref in the $sitename hash");
}
}