Replace using mysql by mariadb in setup/clean script
This commit is contained in:
parent
008fb4424f
commit
f40a3de165
@ -9,7 +9,7 @@
|
||||
|
||||
Name: perl-DBD-MariaDB
|
||||
Version: 1.23
|
||||
Release: 1%{?dist}
|
||||
Release: 2%{?dist}
|
||||
Summary: MariaDB and MySQL driver for the Perl5 Database Interface (DBI)
|
||||
License: GPL-1.0-or-later OR Artistic-1.0-Perl
|
||||
URL: https://metacpan.org/release/DBD-MariaDB/
|
||||
@ -161,14 +161,17 @@ make test %{?with_perl_DBD_MariaDB_enables_leak_test:EXTENDED_TESTING=1}
|
||||
%files
|
||||
%license LICENSE
|
||||
%doc Changes Changes.historic
|
||||
%{perl_vendorarch}/auto/*
|
||||
%{perl_vendorarch}/auto/DBD*
|
||||
%{perl_vendorarch}/DBD*
|
||||
%{_mandir}/man3/*
|
||||
%{_mandir}/man3/DBD::MariaDB*
|
||||
|
||||
%files tests
|
||||
%{_libexecdir}/%{name}
|
||||
|
||||
%changelog
|
||||
* Thu Oct 19 2023 Jitka Plesnikova <jplesnik@redhat.com> - 1.23-2
|
||||
- Replace using mysql by mariadb in setup script
|
||||
|
||||
* Mon Sep 11 2023 Jitka Plesnikova <jplesnik@redhat.com> - 1.23-1
|
||||
- 1.23 bump (rhbz#2238227)
|
||||
|
||||
|
10
test-clean.t
10
test-clean.t
@ -6,11 +6,11 @@ use warnings;
|
||||
use File::Path;
|
||||
use Test::More tests => 2;
|
||||
|
||||
my $MYSQL_DIR = $ENV{'MYSQL_DIR'};
|
||||
my $MYSQL_UNIX_PORT = $ENV{'MYSQL_UNIX_PORT'};
|
||||
my $MYSQL_PIDFILE = $ENV{'MYSQL_PIDFILE'};
|
||||
my $MARIADB_DIR = $ENV{'MARIADB_DIR'};
|
||||
my $MARIADB_UNIX_PORT = $ENV{'MARIADB_UNIX_PORT'};
|
||||
my $MARIADB_PIDFILE = $ENV{'MARIADB_PIDFILE'};
|
||||
|
||||
ok(system("/usr/bin/mysqladmin --user=root --socket=$MYSQL_UNIX_PORT shutdown 2>&1 || [ ! -s \"$MYSQL_PIDFILE\" ] || /bin/kill `cat \"$MYSQL_PIDFILE\"`") == 0);
|
||||
my $removed_count = rmtree($MYSQL_DIR, 1, 1);
|
||||
ok(system("mariadb-admin --user=root --socket=$MARIADB_UNIX_PORT shutdown 2>&1 || [ ! -s \"$MARIADB_PIDFILE\" ] || /bin/kill `cat \"$MARIADB_PIDFILE\"`") == 0);
|
||||
my $removed_count = rmtree($MARIADB_DIR, 1, 1);
|
||||
ok($removed_count > 0);
|
||||
|
||||
|
10
test-env.sh
10
test-env.sh
@ -1,15 +1,15 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# MariaDB setup
|
||||
export MYSQL_DIR=$PWD/t/testdb
|
||||
export MYSQL_UNIX_PORT=$MYSQL_DIR/mysql.sock
|
||||
export MYSQL_PIDFILE=$MYSQL_DIR/mysql.pid
|
||||
export MYSQL_USER=`whoami`
|
||||
export MARIADB_DIR=$PWD/t/testdb
|
||||
export MARIADB_UNIX_PORT=$MARIADB_DIR/mysql.sock
|
||||
export MARIADB_PIDFILE=$MARIADB_DIR/mysql.pid
|
||||
export MARIADB_USER=`whoami`
|
||||
|
||||
# DBD::MariaDB test setup
|
||||
export DBD_MARIADB_TESTDB=testdb
|
||||
export DBD_MARIADB_TESTHOST=localhost
|
||||
export DBD_MARIADB_TESTSOCKET=$MYSQL_UNIX_PORT
|
||||
export DBD_MARIADB_TESTSOCKET=$MARIADB_UNIX_PORT
|
||||
export DBD_MARIADB_TESTUSER=testuser
|
||||
export DBD_MARIADB_TESTPASSWORD=testpassword
|
||||
|
||||
|
35
test-setup.t
35
test-setup.t
@ -6,11 +6,11 @@ use warnings;
|
||||
use Test::More tests => 7;
|
||||
|
||||
# MySQL setup
|
||||
my $MYSQL_DIR = $ENV{'MYSQL_DIR'};
|
||||
my $MYSQL_UNIX_PORT = $ENV{'MYSQL_UNIX_PORT'};
|
||||
my $MYSQL_PIDFILE = $ENV{'MYSQL_PIDFILE'};
|
||||
my $MYSQL_USER = $ENV{'MYSQL_USER'};
|
||||
chomp($MYSQL_USER);
|
||||
my $MARIADB_DIR = $ENV{'MARIADB_DIR'};
|
||||
my $MARIADB_UNIX_PORT = $ENV{'MARIADB_UNIX_PORT'};
|
||||
my $MARIADB_PIDFILE = $ENV{'MARIADB_PIDFILE'};
|
||||
my $MARIADB_USER = $ENV{'MARIADB_USER'};
|
||||
chomp($MARIADB_USER);
|
||||
|
||||
# DBD::MariaDB test setup
|
||||
my $DBD_MARIADB_TESTDB = $ENV{'DBD_MARIADB_TESTDB'};
|
||||
@ -19,24 +19,15 @@ my $DBD_MARIADB_TESTSOCKET = $ENV{'DBD_MARIADB_TESTSOCKET'};
|
||||
my $DBD_MARIADB_TESTUSER = $ENV{'DBD_MARIADB_TESTUSER'};
|
||||
my $DBD_MARIADB_TESTPASSWORD = $ENV{'DBD_MARIADB_TESTPASSWORD'};
|
||||
|
||||
my $MYSQLD = '';
|
||||
my $mysql_version = readpipe("mysql --version");
|
||||
if ($mysql_version =~ /MariaDB/) {
|
||||
system("mysql_install_db --no-defaults --datadir=$MYSQL_DIR --force --skip-name-resolve --explicit_defaults_for_timestamp >/dev/null 2>&1");
|
||||
is($?, 0);
|
||||
$MYSQLD = '/usr/libexec/mysqld';
|
||||
} else {
|
||||
$MYSQLD = '/usr/sbin/mysqld';
|
||||
system("$MYSQLD --no-defaults --initialize-insecure --datadir=$MYSQL_DIR --explicit_defaults_for_timestamp --user=$MYSQL_USER >/dev/null 2>&1");
|
||||
is($?, 0);
|
||||
}
|
||||
system("mariadb-install-db --no-defaults --datadir=$MARIADB_DIR --force --skip-name-resolve --explicit_defaults_for_timestamp >/dev/null 2>&1");
|
||||
is($?, 0);
|
||||
|
||||
my $cmd = "$MYSQLD --no-defaults --user=$MYSQL_USER --socket=$MYSQL_UNIX_PORT --datadir=$MYSQL_DIR --pid-file=$MYSQL_PIDFILE --explicit_defaults_for_timestamp --skip-networking >/dev/null 2>&1 &";
|
||||
my $cmd = "mariadbd --no-defaults --user=$MARIADB_USER --socket=$MARIADB_UNIX_PORT --datadir=$MARIADB_DIR --pid-file=$MARIADB_PIDFILE --explicit_defaults_for_timestamp --skip-networking >/dev/null 2>&1 &";
|
||||
system($cmd);
|
||||
is($?, 0);
|
||||
|
||||
my $attempts = 0;
|
||||
while (system("/usr/bin/mysqladmin --user=root --socket=$MYSQL_UNIX_PORT ping >/dev/null 2>&1") != 0) {
|
||||
while (system("mariadb-admin --user=root --socket=$MARIADB_UNIX_PORT ping >/dev/null 2>&1") != 0) {
|
||||
sleep 3;
|
||||
$attempts++;
|
||||
if ($attempts > 10) {
|
||||
@ -45,11 +36,11 @@ while (system("/usr/bin/mysqladmin --user=root --socket=$MYSQL_UNIX_PORT ping >/
|
||||
}
|
||||
ok(1);
|
||||
|
||||
system("mysql --socket=$MYSQL_UNIX_PORT --execute \"CREATE USER '$DBD_MARIADB_TESTUSER\@localhost';\" 2>&1");
|
||||
system("mariadb --socket=$MARIADB_UNIX_PORT --execute \"CREATE USER '$DBD_MARIADB_TESTUSER\@localhost';\" 2>&1");
|
||||
is($?, 0);
|
||||
system("mysql --socket=$MYSQL_UNIX_PORT --execute \"CREATE DATABASE IF NOT EXISTS $DBD_MARIADB_TESTDB CHARACTER SET='utf8mb4';\" 2>&1");
|
||||
system("mariadb --socket=$MARIADB_UNIX_PORT --execute \"CREATE DATABASE IF NOT EXISTS $DBD_MARIADB_TESTDB CHARACTER SET='utf8mb4';\" 2>&1");
|
||||
is($?, 0);
|
||||
system("mysql --socket=$MYSQL_UNIX_PORT --execute \"GRANT ALL PRIVILEGES ON $DBD_MARIADB_TESTDB.* TO '$DBD_MARIADB_TESTUSER\@localhost' IDENTIFIED BY '$DBD_MARIADB_TESTPASSWORD';\" 2>&1");
|
||||
system("mariadb --socket=$MARIADB_UNIX_PORT --execute \"GRANT ALL PRIVILEGES ON $DBD_MARIADB_TESTDB.* TO '$DBD_MARIADB_TESTUSER\@localhost' IDENTIFIED BY '$DBD_MARIADB_TESTPASSWORD';\" 2>&1");
|
||||
is($?, 0);
|
||||
system("/usr/bin/mysqladmin --user=$DBD_MARIADB_TESTUSER --password=$DBD_MARIADB_TESTPASSWORD --socket=$DBD_MARIADB_TESTSOCKET ping >/dev/null 2>&1");
|
||||
system("mariadb-admin --user=$DBD_MARIADB_TESTUSER --password=$DBD_MARIADB_TESTPASSWORD --socket=$DBD_MARIADB_TESTSOCKET ping >/dev/null 2>&1");
|
||||
is($?, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user