Resolves: RHEL-66250

Generate SSL needed for tests since mariadb-connector-c 3.4.x
This commit is contained in:
Jitka Plesnikova 2025-01-30 10:35:53 +01:00
parent c2c7297cbd
commit a7ec433358
7 changed files with 79 additions and 26 deletions

View File

@ -1,14 +1,19 @@
diff -up DBD-MariaDB-1.21/t/testrules.yml.orig DBD-MariaDB-1.21/t/testrules.yml
--- DBD-MariaDB-1.21/t/testrules.yml.orig 2019-07-03 11:38:30.204870398 +0200
+++ DBD-MariaDB-1.21/t/testrules.yml 2019-07-03 11:38:41.334062976 +0200
@@ -1,4 +1,5 @@
diff -up DBD-MariaDB-1.23/t/testrules.yml.orig DBD-MariaDB-1.23/t/testrules.yml
--- DBD-MariaDB-1.23/t/testrules.yml.orig 2023-09-10 16:18:55.000000000 +0200
+++ DBD-MariaDB-1.23/t/testrules.yml 2024-12-10 12:14:23.045521148 +0100
@@ -1,10 +1,11 @@
seq:
+ - seq: t/test-setup.t
- seq: t/00base.t
- seq: t/05dbcreate.t
- seq: t/10connect.t
@@ -8,3 +9,4 @@ seq:
- seq: t/rt75353-innodb-lock-timeout.t
- seq: t/rt85919-fetch-lost-connection.t
+ - seq: t/87async.t
+ - seq: t/rt75353-innodb-lock-timeout.t
+ - seq: t/rt85919-fetch-lost-connection.t
- par:
- - seq: t/60leaks.t
- - seq: t/87async.t
- - seq: t/rt75353-innodb-lock-timeout.t
- - seq: t/rt85919-fetch-lost-connection.t
- par: **
+ - seq: t/test-clean.t

View File

@ -0,0 +1,15 @@
diff -up DBD-MariaDB-1.23/lib/DBD/MariaDB.pod.orig DBD-MariaDB-1.23/lib/DBD/MariaDB.pod
--- DBD-MariaDB-1.23/lib/DBD/MariaDB.pod.orig 2025-01-30 09:03:33.747471104 +0100
+++ DBD-MariaDB-1.23/lib/DBD/MariaDB.pod 2025-01-30 09:11:11.286887719 +0100
@@ -281,6 +281,11 @@ L<I<mariadb_ssl_ca_path>|/mariadb_ssl_ca
This means that your communication with the server will be encrypted.
+NOTE: Due to the changes in mariadb-connector-c 3.4.0, this option does not
+have any effect. That might change in a future release. However, you will
+need MariaDB with enabled SSL support on server side, otherwise you get
+'TLS/SSL error'.
+
=item mariadb_ssl_ca_file
The path to a file in PEM format that contains a list of trusted SSL certificate

View File

@ -1,16 +1,11 @@
# Fedora
--- !Policy
id: fedora_policy
product_versions:
- fedora-*
decision_context: bodhi_update_push_testing
subject_type: koji_build
rules:
- !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional}
# Rawhide
--- !Policy
product_versions:
- fedora-*
decision_context: bodhi_update_push_stable
decision_contexts:
- bodhi_update_push_testing
- bodhi_update_push_stable
subject_type: koji_build
rules:
- !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional}

View File

@ -9,7 +9,7 @@
Name: perl-DBD-MariaDB
Version: 1.23
Release: 7%{?dist}
Release: 8%{?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/
@ -18,6 +18,8 @@ Source1: test-setup.t
Source2: test-clean.t
Source3: test-env.sh
Patch0: DBD-MariaDB-1.21-Run-test-setup-and-clean.patch
# Note about changes in mariadb-connector-c which affected SSL connection
Patch1: DBD-MariaDB-1.23-Note-about-mariadb-connector-c.patch
BuildRequires: findutils
BuildRequires: gcc
BuildRequires: make
@ -40,6 +42,7 @@ BuildRequires: perl(Getopt::Long)
BuildRequires: perl(strict)
BuildRequires: perl(utf8)
BuildRequires: perl(warnings)
BuildRequires: sscg
# Tests
BuildRequires: hostname
BuildRequires: mariadb
@ -105,8 +108,14 @@ with "%{_libexecdir}/%{name}/test".
%prep
%setup -q -n DBD-MariaDB-%{version}
%patch -P0 -p1
%patch -P1 -p1
cp %{SOURCE1} %{SOURCE2} t/
# Create certificates for tests
mkdir t/certs
sscg --hostname=localhost --ca-mode=0644 --ca-key-mode=0640 --cert-key-mode=0640 --no-dhparams-file
mv ca.crt service-key.pem service.pem t/certs
# Help file to recognise the Perl scripts and normalize shebangs
for F in t/*.t t/*.pl; do
perl -i -MConfig -ple 'print $Config{startperl} if $. == 1 && !s{\A#!.*perl\b}{$Config{startperl}}' "$F"
@ -136,21 +145,32 @@ perl Makefile.PL INSTALLDIRS=vendor OPTIMIZE="$RPM_OPT_FLAGS" NO_PACKLIST=1 NO_P
%install
%{make_install}
find %{buildroot} -type f -name '*.bs' -size 0 -delete
%{_fixperms} %{buildroot}/*
# Install tests
mkdir -p %{buildroot}%{_libexecdir}/%{name}
cp -a t %{buildroot}%{_libexecdir}/%{name}
cp %{SOURCE3} %{buildroot}%{_libexecdir}/%{name}
cat > %{buildroot}%{_libexecdir}/%{name}/test << EOF
#!/bin/sh
cat > %{buildroot}%{_libexecdir}/%{name}/test << 'EOF'
#!/usr/bin/bash
set -e
unset RELEASE_TESTING
. %{_libexecdir}/%{name}/$(basename %{SOURCE3})
cd %{_libexecdir}/%{name} && exec prove -I .
# The tests write to temporary database which is placed in $DIR/t/testdb
DIR=$(mktemp -d)
pushd "$DIR"
cp -a %{_libexecdir}/%{name}/* ./
# Load the variables
. $DIR/$(basename %{SOURCE3})
# Run tests
prove -I . -j "$(getconf _NPROCESSORS_ONLN)"
popd
rm -rf "$DIR"
EOF
chmod +x %{buildroot}%{_libexecdir}/%{name}/test
%{_fixperms} %{buildroot}/*
%check
# Set MariaDB and DBD::MariaDB test environment
. %{SOURCE3}
@ -169,6 +189,10 @@ make test %{?with_perl_DBD_MariaDB_enables_leak_test:EXTENDED_TESTING=1}
%{_libexecdir}/%{name}
%changelog
* Tue Jan 28 2025 Jitka Plesnikova <jplesnik@redhat.com> - 1.23-8
- Generate SSL needed for tests since mariadb-connector-c 3.4.x
- Resolves: RHEL-66250
* Tue Oct 29 2024 Troy Dawson <tdawson@redhat.com> - 1.23-7
- Bump release for October 2024 mass rebuild:
Resolves: RHEL-64018

12
plans/internal.fmf Normal file
View File

@ -0,0 +1,12 @@
summary: Private (RHEL) beakerlib tests
enabled: false
adjust:
- when: distro == rhel
enabled: true
because: private tests are accesible only within rhel pipline
discover:
- name: rhel
how: fmf
url: https://pkgs.devel.redhat.com/git/tests/perl-DBD-MariaDB
execute:
how: tmt

View File

@ -1,7 +1,8 @@
#!/usr/bin/bash
# MariaDB setup
export MARIADB_DIR=$PWD/t/testdb
export MARIADB_BASE=$PWD
export MARIADB_DIR=$MARIADB_BASE/t/testdb
export MARIADB_UNIX_PORT=$MARIADB_DIR/mysql.sock
export MARIADB_PIDFILE=$MARIADB_DIR/mysql.pid
export MARIADB_USER=`whoami`

View File

@ -6,6 +6,7 @@ use warnings;
use Test::More tests => 7;
# MySQL setup
my $MARIADB_BASE = $ENV{'MARIADB_BASE'};
my $MARIADB_DIR = $ENV{'MARIADB_DIR'};
my $MARIADB_UNIX_PORT = $ENV{'MARIADB_UNIX_PORT'};
my $MARIADB_PIDFILE = $ENV{'MARIADB_PIDFILE'};
@ -22,7 +23,7 @@ my $DBD_MARIADB_TESTPASSWORD = $ENV{'DBD_MARIADB_TESTPASSWORD'};
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 = "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 &";
my $cmd = "mariadbd-safe --no-defaults --user=$MARIADB_USER --socket=$MARIADB_UNIX_PORT --datadir=$MARIADB_DIR --pid-file=$MARIADB_PIDFILE --ssl_cert=$MARIADB_BASE/t/certs/service.pem --ssl_key=$MARIADB_BASE/t/certs/service-key.pem --ssl_ca=$MARIADB_BASE/t/certs/ca.crt --skip-networking >/dev/null 2>&1 &";
system($cmd);
is($?, 0);