PT-191 - add ssl options to DSN

- Added test cases to ensure SSL is working in all tools
This commit is contained in:
Sveta Smirnova
2025-07-26 14:18:30 +03:00
parent 7a8fee3d86
commit b7094dfd09
25 changed files with 808 additions and 15 deletions

View File

@@ -29,7 +29,7 @@ elsif ( $sandbox_version lt '8.0' ) {
my $output;
my $cnf = '/tmp/12345/my.sandbox.cnf';
my $cmd = "$trunk/bin/pt-find -F $cnf ";
my $cmd = "$trunk/bin/pt-find";
$sb->do_as_root(
'source',
@@ -37,7 +37,7 @@ $sb->do_as_root(
q/GRANT ALL ON *.* TO sha256_user@'%'/,
);
$output = `$cmd mysql --tblregex column --user=sha256_user --password=sha256_user%password --mysql_ssl=0 2>&1`;
$output = `$cmd -F $cnf --host=127.0.0.1 --port=12345 mysql --tblregex column --user=sha256_user --password=sha256_user%password --mysql_ssl=0 2>&1`;
isnt(
$?,
@@ -47,11 +47,11 @@ isnt(
like(
$output,
qr/Access denied/,
qr/Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection./,
'Secure connection error raised when no SSL connection used'
) or diag($output);
$output = `$cmd mysql --tblregex column --user=sha256_user --password=sha256_user%password --mysql_ssl=1 2>&1`;
$output = `$cmd -F $cnf --host=127.0.0.1 --port=12345 mysql --tblregex column --user=sha256_user --password=sha256_user%password --mysql_ssl=1 2>&1`;
is(
$?,
@@ -61,12 +61,40 @@ is(
unlike(
$output,
qr/Access denied/,
qr/Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection./,
'Secure connection error raised when no SSL connection used'
) or diag($output);
like($output, qr/`mysql`.`columns_priv`/, 'Found mysql.columns_priv');
$output = `$cmd -F t/pt-archiver/samples/pt-191.cnf --host=127.0.0.1 --port=12345 mysql --tblregex column --user=sha256_user --password=sha256_user%password --mysql_ssl=1 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 --host=127.0.0.1 --port=12345 mysql --tblregex column --user=sha256_user --password=sha256_user%password --mysql_ssl=1 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.
# #############################################################################