From a7ec433358324d4625da8d254a380faa19e2cf7e Mon Sep 17 00:00:00 2001 From: Jitka Plesnikova Date: Thu, 30 Jan 2025 10:35:53 +0100 Subject: [PATCH] Resolves: RHEL-66250 Generate SSL needed for tests since mariadb-connector-c 3.4.x --- ...ariaDB-1.21-Run-test-setup-and-clean.patch | 19 ++++++---- ...-1.23-Note-about-mariadb-connector-c.patch | 15 ++++++++ gating.yaml | 15 +++----- perl-DBD-MariaDB.spec | 38 +++++++++++++++---- plans/internal.fmf | 12 ++++++ test-env.sh | 3 +- test-setup.t | 3 +- 7 files changed, 79 insertions(+), 26 deletions(-) create mode 100644 DBD-MariaDB-1.23-Note-about-mariadb-connector-c.patch create mode 100644 plans/internal.fmf diff --git a/DBD-MariaDB-1.21-Run-test-setup-and-clean.patch b/DBD-MariaDB-1.21-Run-test-setup-and-clean.patch index f07a6cb..c40dd35 100644 --- a/DBD-MariaDB-1.21-Run-test-setup-and-clean.patch +++ b/DBD-MariaDB-1.21-Run-test-setup-and-clean.patch @@ -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 diff --git a/DBD-MariaDB-1.23-Note-about-mariadb-connector-c.patch b/DBD-MariaDB-1.23-Note-about-mariadb-connector-c.patch new file mode 100644 index 0000000..c42a7cb --- /dev/null +++ b/DBD-MariaDB-1.23-Note-about-mariadb-connector-c.patch @@ -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|/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 diff --git a/gating.yaml b/gating.yaml index a5f7f45..da7481a 100644 --- a/gating.yaml +++ b/gating.yaml @@ -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} diff --git a/perl-DBD-MariaDB.spec b/perl-DBD-MariaDB.spec index 348fd22..bad9a3e 100644 --- a/perl-DBD-MariaDB.spec +++ b/perl-DBD-MariaDB.spec @@ -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 - 1.23-8 +- Generate SSL needed for tests since mariadb-connector-c 3.4.x +- Resolves: RHEL-66250 + * Tue Oct 29 2024 Troy Dawson - 1.23-7 - Bump release for October 2024 mass rebuild: Resolves: RHEL-64018 diff --git a/plans/internal.fmf b/plans/internal.fmf new file mode 100644 index 0000000..d6e3419 --- /dev/null +++ b/plans/internal.fmf @@ -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 diff --git a/test-env.sh b/test-env.sh index d362341..213c33b 100755 --- a/test-env.sh +++ b/test-env.sh @@ -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` diff --git a/test-setup.t b/test-setup.t index 14c6f47..4315360 100755 --- a/test-setup.t +++ b/test-setup.t @@ -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);