Update setup script due to Pali's comments
This commit is contained in:
parent
31466206db
commit
9e19b58fe1
@ -1,6 +1,6 @@
|
||||
Name: perl-DBD-MariaDB
|
||||
Version: 1.21
|
||||
Release: 6%{?dist}
|
||||
Release: 7%{?dist}
|
||||
Summary: MariaDB and MySQL driver for the Perl5 Database Interface (DBI)
|
||||
License: GPL+ or Artistic
|
||||
URL: https://metacpan.org/release/DBD-MariaDB/
|
||||
@ -42,6 +42,7 @@ BuildRequires: perl(constant)
|
||||
BuildRequires: perl(CPAN::Meta::YAML)
|
||||
BuildRequires: perl(DBI::Const::GetInfoType)
|
||||
BuildRequires: perl(Encode)
|
||||
BuildRequires: perl(File::Path)
|
||||
BuildRequires: perl(File::Temp)
|
||||
BuildRequires: perl(FindBin)
|
||||
BuildRequires: perl(lib)
|
||||
@ -91,6 +92,9 @@ make test
|
||||
%{_mandir}/man3/*
|
||||
|
||||
%changelog
|
||||
* Fri Apr 17 2020 Jitka Plesnikova <jplesnik@redhat.com> - 1.21-7
|
||||
- Update setup script due to Pali's comments
|
||||
|
||||
* Tue Feb 04 2020 Jitka Plesnikova <jplesnik@redhat.com> - 1.21-6
|
||||
- Update setup script to work with MariaDB 10.4
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use File::Path;
|
||||
use Test::More tests => 2;
|
||||
|
||||
my $MYSQL_DIR = $ENV{'MYSQL_DIR'};
|
||||
@ -10,5 +11,6 @@ my $MYSQL_UNIX_PORT = $ENV{'MYSQL_UNIX_PORT'};
|
||||
my $MYSQL_PIDFILE = $ENV{'MYSQL_PIDFILE'};
|
||||
|
||||
ok(system("/usr/bin/mysqladmin --user=root --socket=$MYSQL_UNIX_PORT shutdown 2>&1 || [ ! -s \"$MYSQL_PIDFILE\" ] || /bin/kill `cat \"$MYSQL_PIDFILE\"`") == 0);
|
||||
ok(system("rm -rf $MYSQL_DIR") == 0);
|
||||
my $removed_count = rmtree($MYSQL_DIR, 1, 1);
|
||||
ok($removed_count > 0);
|
||||
|
||||
|
25
test-setup.t
25
test-setup.t
@ -3,7 +3,7 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Test::More tests => 6;
|
||||
use Test::More tests => 7;
|
||||
|
||||
# MySQL setup
|
||||
my $MYSQL_DIR = $ENV{'MYSQL_DIR'};
|
||||
@ -23,38 +23,33 @@ 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");
|
||||
ok($? >> 8 == 0);
|
||||
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");
|
||||
ok($? >> 8 == 0);
|
||||
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 $pid = fork();
|
||||
if (defined($pid) && $pid==0) {
|
||||
# background process
|
||||
system($cmd);
|
||||
exit $? >> 8;
|
||||
}
|
||||
system($cmd);
|
||||
is($?, 0);
|
||||
|
||||
my $attempts = 0;
|
||||
while (system("/usr/bin/mysqladmin --user=root --socket=$MYSQL_UNIX_PORT ping >/dev/null 2>&1") != 0) {
|
||||
sleep 3;
|
||||
$attempts++;
|
||||
if ($attempts > 10) {
|
||||
printf "skipping test, mariadb/mysql server could not be contacted after 30 seconds\n";
|
||||
ok(0);
|
||||
fail("skipping test, mariadb/mysql server could not be contacted after 30 seconds\n");
|
||||
}
|
||||
}
|
||||
ok(1);
|
||||
|
||||
system("mysql --socket=$MYSQL_UNIX_PORT --execute \"CREATE USER '$DBD_MARIADB_TESTUSER\@localhost';\" 2>&1");
|
||||
ok($? >> 8 == 0);
|
||||
is($?, 0);
|
||||
system("mysql --socket=$MYSQL_UNIX_PORT --execute \"CREATE DATABASE IF NOT EXISTS $DBD_MARIADB_TESTDB CHARACTER SET='utf8mb4';\" 2>&1");
|
||||
ok($? >> 8 == 0);
|
||||
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");
|
||||
ok($? >> 8 == 0);
|
||||
is($?, 0);
|
||||
system("/usr/bin/mysqladmin --user=$DBD_MARIADB_TESTUSER --password=$DBD_MARIADB_TESTPASSWORD --socket=$DBD_MARIADB_TESTSOCKET ping >/dev/null 2>&1");
|
||||
ok($? >> 8 == 0);
|
||||
is($?, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user