mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-02 02:34:19 +00:00
PT-191 - add ssl options to DSN
- Added test cases to ensure SSL is working in all tools
This commit is contained in:
@@ -30,12 +30,12 @@ elsif ( $sandbox_version lt '8.0' ) {
|
||||
plan skip_all => "Requires MySQL 8.0 or newer";
|
||||
}
|
||||
else {
|
||||
plan tests => 6;
|
||||
plan tests => 10;
|
||||
}
|
||||
|
||||
my ($output, $exit_code);
|
||||
my $cnf = '/tmp/12345/my.sandbox.cnf';
|
||||
my $cmd = "$trunk/bin/pt-kill -F $cnf";
|
||||
my $cmd = "$trunk/bin/pt-kill";
|
||||
|
||||
$sb->do_as_root(
|
||||
'source',
|
||||
@@ -43,7 +43,7 @@ $sb->do_as_root(
|
||||
q/GRANT PROCESS ON *.* TO sha256_user@'%'/,
|
||||
);
|
||||
|
||||
$output = `$cmd h=127.1,P=12345,u=sha256_user,p=sha256_user%password,s=0 --busy-time 1s --print --run-time 10 2>&1`;
|
||||
$output = `$cmd F=$cnf,h=127.1,P=12345,u=sha256_user,p=sha256_user%password,s=0 --busy-time 1s --print --run-time 10 2>&1`;
|
||||
|
||||
isnt(
|
||||
$?,
|
||||
@@ -61,7 +61,7 @@ like(
|
||||
# Backticks don't work here.
|
||||
system("/tmp/12345/use -e 'select sleep(5)' >/dev/null &");
|
||||
|
||||
$output = `$cmd h=127.1,P=12345,u=sha256_user,p=sha256_user%password,s=1 --busy-time 1s --print --run-time 10 2>&1`;
|
||||
$output = `$cmd F=$cnf,h=127.1,P=12345,u=sha256_user,p=sha256_user%password,s=1 --busy-time 1s --print --run-time 10 2>&1`;
|
||||
|
||||
is(
|
||||
$?,
|
||||
@@ -91,6 +91,34 @@ ok(
|
||||
"There were 2 to 5 captures"
|
||||
) or diag($output);
|
||||
|
||||
$output = `$cmd F=t/pt-archiver/samples/pt-191.cnf,h=127.1,P=12345,u=sha256_user,p=sha256_user%password,s=1 --busy-time 1s --print --run-time 10 2>&1`;
|
||||
|
||||
is(
|
||||
$?,
|
||||
0,
|
||||
"No error for SSL options in the configuration file"
|
||||
) or diag($output);
|
||||
|
||||
unlike(
|
||||
$output,
|
||||
qr/Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection./,
|
||||
'No secure connection error with correct SSL options in the configuration file'
|
||||
) or diag($output);
|
||||
|
||||
$output = `$cmd F=t/pt-archiver/samples/pt-191-error.cnf,h=127.1,P=12345,u=sha256_user,p=sha256_user%password,s=1 --busy-time 1s --print --run-time 10 2>&1`;
|
||||
|
||||
isnt(
|
||||
$?,
|
||||
0,
|
||||
"Error for invalid SSL options in the configuration file"
|
||||
) or diag($output);
|
||||
|
||||
like(
|
||||
$output,
|
||||
qr/SSL connection error: Unable to get private key at/,
|
||||
'SSL connection error with incorrect SSL options in the configuration file'
|
||||
) or diag($output);
|
||||
|
||||
# #############################################################################
|
||||
# Done.
|
||||
# #############################################################################
|
||||
|
Reference in New Issue
Block a user