mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-13 06:30:10 +00:00
Make init_agent() stop on 403 (too many agents).
This commit is contained in:
@@ -274,6 +274,50 @@ is_deeply(
|
||||
"PUT then GET Agent"
|
||||
) or diag(Dumper($ua->{requests}));
|
||||
|
||||
# #############################################################################
|
||||
# Status 403 (too many agents) should abort further attempts.
|
||||
# #############################################################################
|
||||
|
||||
$ua->{responses}->{post} = [
|
||||
{ # 1, the fake error
|
||||
code => 403,
|
||||
},
|
||||
];
|
||||
|
||||
@ok = qw(1 1 0);
|
||||
@wait = ();
|
||||
@log = ();
|
||||
$ua->{requests} = [];
|
||||
|
||||
$output = output(
|
||||
sub {
|
||||
($got_agent) = pt_agent::init_agent(
|
||||
agent => $post_agent,
|
||||
action => 'post',
|
||||
link => "/agents",
|
||||
client => $client,
|
||||
interval => $interval,
|
||||
tries => 3,
|
||||
oktorun => $oktorun,
|
||||
);
|
||||
},
|
||||
stderr => 1,
|
||||
);
|
||||
|
||||
is(
|
||||
scalar @wait,
|
||||
0,
|
||||
"Too many agents (403): no wait"
|
||||
);
|
||||
|
||||
is_deeply(
|
||||
$ua->{requests},
|
||||
[
|
||||
'POST /agents',
|
||||
],
|
||||
"Too many agents (403): no further requests"
|
||||
) or diag(Dumper($ua->{requests}));
|
||||
|
||||
# #############################################################################
|
||||
# Done.
|
||||
# #############################################################################
|
||||
|
Reference in New Issue
Block a user