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:
parent
3e2bad5cb4
commit
dd53243b08
2 changed files with 22 additions and 17 deletions
|
|
@ -273,9 +273,6 @@ sub getJsonStatus {
|
|||
my ($kernel, $request, $self) = @_[KERNEL,ARG0,OBJECT];
|
||||
my ($sitename, $rsvp) = @$request;
|
||||
|
||||
# only return this site's info
|
||||
#return $kernel->call(IKC=>post=>$rsvp, '{}') unless $sitename;
|
||||
|
||||
my %queues = ();
|
||||
tie %queues, 'Tie::IxHash';
|
||||
%queues = (
|
||||
|
|
@ -291,11 +288,13 @@ sub getJsonStatus {
|
|||
if ($count > 0) {
|
||||
for my $queueItem ($queue->peek_items(sub {1})) {
|
||||
my($priority, $id, $instance) = @{$queueItem};
|
||||
# it's not a hash ref, we haven't seen it yet
|
||||
# The site's name in the list of %output keys isn't a hashref;
|
||||
# we haven't seen it yet
|
||||
if(ref $output{$instance->{sitename}} ne 'HASH') {
|
||||
$output{$instance->{sitename}} = {};
|
||||
}
|
||||
# it's not an array ref, we haven't seen it yet
|
||||
# The queue name in the $output{sitename} hashref isn't an
|
||||
# arrayref; we haven't seen it yet
|
||||
if(ref $output{$instance->{sitename}}{$queueName} ne 'ARRAY') {
|
||||
$output{$instance->{sitename}}{$queueName} = [];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue