pt-heartbeat: Add an option to handle running on servers with read_only=1

This commit is contained in:
Brian Fraser
2013-02-21 08:11:28 -03:00
parent bb3dfd27fd
commit f06f930498
2 changed files with 55 additions and 0 deletions

View File

@@ -238,6 +238,41 @@ is(
"No slave error"
);
# #############################################################################
# --check-read-only
# #############################################################################
diag(`/tmp/12345/use -u root -e "GRANT ALL ON *.* TO 'bob'\@'%' IDENTIFIED BY 'msandbox'"`);
diag(`/tmp/12345/use -u root -e "REVOKE SUPER ON *.* FROM 'bob'\@'%'"`);
$output = output(
sub { pt_heartbeat::main("u=bob,F=/tmp/12346/my.sandbox.cnf",
qw(-D test --update --replace --run-time 1))
},
stderr => 1
);
like(
$output,
qr/--read-only/,
"By default, fails if the server is read_only=1"
);
$output = output(
sub { pt_heartbeat::main("u=bob,F=/tmp/12346/my.sandbox.cnf",
qw(-D test --update --replace --run-time 1 --check-read-only))
},
stderr => 1
);
unlike(
$output,
qr/--read-only/,
"...but just skips doing any work and waits if --check-read-only was specified"
);
diag(`/tmp/12345/use -u root -e "DROP USER 'bob'\@'%'"`);
# #############################################################################
# Done.
# #############################################################################