Commit 79a26bc2 authored by Kevin Tew's avatar Kevin Tew

testsuite/testswap fixed socket timeout on swapping ops

parent 74e25499
......@@ -21,8 +21,8 @@ BEGIN {
}
#constructs RPC::XML::Client with 10 minute socket timeout
my $HTTP_TIMEOUT = $TBConfig::XMLRPC_SERVER_TIMEOUT;
has 'client' => ( isa => 'RPC::XML::Client', is => 'rw', default => sub {
my $HTTP_TIMEOUT = $TBConfig::XMLRPC_SERVER_TIMEOUT;
my $c = RPC::XML::Client->new($TBConfig::XMLRPC_SERVER, 'timeout' => ($HTTP_TIMEOUT));
$c->{'__useragent'}->timeout($HTTP_TIMEOUT);
$c; } );
......@@ -72,6 +72,9 @@ sub single_request {
say("Received");
say Dumper($resp);
}
if ((!ref($resp)) && ($resp =~ /SSL \w+ timeout/)) {
die "SSL_SOCKET_TIMEOUT";
}
$resp;
}
......
......@@ -30,6 +30,19 @@ sub args {
return { 'pid' => $pid, 'gid' => $gid, 'eid' => $eid, @_ };
}
sub retry_on_TIMEOUT(&) {
my ($sub) = @_;
RETRY:
{
my $result = eval { $sub->(); };
if ($@ && $@ =~ /SSL_SOCKET_TIMEOUT/) {
warn "SSL_SOCKET_TIMEOUT after $TBConfig::XMLRPC_SERVER_TIMEOUT seconds";
redo RETRY;
}
$result;
}
}
sub echo { shift->augment_output( 'str' => shift ); }
sub getlist_brief { shift->augment( 'format' => 'brief'); }
sub getlist_full { shift->augment( 'format' => 'full' ); }
......@@ -39,8 +52,8 @@ sub swapin { shift->augment_func_code( 'swapexp', 'direction' => 'in' );
sub swapout { shift->augment_func_code( 'swapexp', 'direction' => 'out' ); }
sub end { shift->augment_func_code( 'endexp' ); }
sub nodeinfo { parseNodeInfo(shift->augment_func_output('expinfo', 'show' => 'nodeinfo')); }
sub waitforactive { shift->augment_code(@_) }
sub waitforswapped { shift->augment_func_code( 'statewait', 'state' => 'swapped' ) }
sub waitforactive { my $e = shift; retry_on_TIMEOUT { $e->augment_func_code('waitforactive', @_) }; }
sub waitforswapped { my $e = shift; retry_on_TIMEOUT { $e->augment_func_code( 'statewait', 'state' => 'swapped' ) }; }
sub startexp_ns { batchexp_ns(@_, 'batch' => 0); }
sub startexp_ns_wait { batchexp_ns_wait(@_, 'batch' => 0); }
......
......@@ -14,4 +14,4 @@ set node1 [$ns node]
$ns run
NSEND
ok(e('tewkt')->launchpingswapkill($ns));
ok(e('sn1')->launchpingswapkill($ns));
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment