File: 01caching_sha2_prime.t

package info (click to toggle)
libdbd-mysql-perl 4.053-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,128 kB
  • sloc: ansic: 4,780; perl: 836; makefile: 29; sh: 22
file content (30 lines) | stat: -rw-r--r-- 735 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use strict;
use warnings;

use Test::More ;
use DBI;
$|= 1;

use vars qw($test_user $test_password $test_db $test_dsn);
use lib 't', '.';
require 'lib.pl';

# remove database from DSN
$test_dsn =~ s/^DBI:mysql:([^:]+)(:?)/DBI:mysql:$2/;

# This should result in a cached sha2 password entry
# The result is that subsequent connections don't need
# TLS or the RSA pubkey.
$test_dsn .= ';mysql_ssl=1;mysql_get_server_pubkey=1';

my $dbh;
eval {$dbh= DBI->connect($test_dsn, $test_user, $test_password,
                      { RaiseError => 1, PrintError => 1, AutoCommit => 0 });};
if ($@) {
    diag $@;
    plan skip_all => "no database connection";
}
plan tests => 2;

ok defined $dbh, "Connected to database";
ok $dbh->disconnect();