mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-11 13:40:07 +00:00
Fix/update t/pt-agent/init_agent.t.
This commit is contained in:
@@ -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 ) {
|
||||
|
@@ -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}));
|
||||
|
||||
# #############################################################################
|
||||
|
Reference in New Issue
Block a user