Fix/update t/pt-agent/init_agent.t.

This commit is contained in:
Daniel Nichter
2013-03-19 14:44:02 -06:00
parent 2291a3c6c6
commit 70c28272a7
2 changed files with 22 additions and 5 deletions

View File

@@ -150,6 +150,12 @@ sub output {
die "I need a code argument" unless $code;
my ($file, $stderr, $die, $trf) = @args{qw(file stderr die trf)};
if ( $args{debug} ) {
my $retval = eval { $code->() };
warn $EVAL_ERROR if $EVAL_ERROR;
return $retval;
}
my $output = '';
{
if ( $file ) {

View File

@@ -44,7 +44,7 @@ is(
# #############################################################################
my $return_agent = {
id => '123',
uuid => '123',
hostname => `hostname`,
versions => {
'Percona::WebAPI::Client' => "$Percona::WebAPI::Client::VERSION",
@@ -114,7 +114,7 @@ ok(
$output = `cat $tmpdir/agent 2>/dev/null`;
like(
$output,
qr/"id":"123"/,
qr/"uuid":"123"/,
"Saved new Agent"
) or diag($output);
@@ -219,7 +219,17 @@ my $saved_agent = Percona::WebAPI::Resource::Agent->new(%$hashref);
$ua->{responses}->{put} = [
{
code => 200,
headers => {
Location => '/agents/123',
},
},
];
$ua->{responses}->{get} = [
{
code => 200,
headers => { 'X-Percona-Resource-Type' => 'Agent' },
content => $return_agent,
}
];
@wait = ();
@@ -258,9 +268,10 @@ is(
is_deeply(
$ua->{requests},
[
'PUT /agents',
'PUT /agents/123',
'GET /agents/123',
],
"PUT saved Agent"
"PUT then GET saved Agent"
) or diag(Dumper($ua->{requests}));
# #############################################################################