This commit is based on one of the commits by Michal Schorm
<mschorm@redhat.com>. Thanks!
* https://src.fedoraproject.org/rpms/rubygem-mysql2/pull-request/13
- [5/6] Testsuite fix - enhance the error handling of the loop that checks
whether the DB server is alive
* https://bugzilla.redhat.com/show_bug.cgi?id=2144488#c2
- (3) While waiting for the DB server to come online
In the previous logic, the DB connection logic didn't exit correctly with error
when the last 10th try still fails. The new logic makes the logic fail
properly, and prints the DB error log file. The printed log makes us debug
easily.
This commit fixes the broken SSL tests below.
The rubygem-mysql2 build started to fail with the error below by the `mysql`
that can't connect to the MariaDB server, when a dependency mariadb was upgraded
from the version 3:10.5.16-3.fc37 to 3:10.5.18-1.fc38.
https://koschei.fedoraproject.org/build/14086115
build.log
~~~
+ /usr/libexec/mysqld --datadir=/builddir/build/BUILD/mysql2-0.5.4/usr/share/gems/gems/mysql2-0.5.4/data --log-error=/builddir/build/BUILD/mysql2-0.5.4/usr/share/gems/gems/mysql2-0.5.4/mysql.log --socket=/builddir/build/BUILD/mysql2-0.5.4/usr/share/gems/gems/mysql2-0.5.4/mysql.sock --pid-file=/builddir/build/BUILD/mysql2-0.5.4/usr/share/gems/gems/mysql2-0.5.4/mysql.pid --port=13471 --ssl
++ seq 10
+ for i in $(seq 10)
+ sleep 1
2022-11-17 11:20:48 0 [Note] /usr/libexec/mysqld (mysqld 10.5.18-MariaDB) starting as process 1297 ...
+ grep -q 'ready for connections.' /builddir/build/BUILD/mysql2-0.5.4/usr/share/gems/gems/mysql2-0.5.4/mysql.log
+ echo 'Waiting connections... 1'
...
+ echo 'Waiting connections... 10'
Waiting connections... 10
+ mysql -u mockbuild -e 'ALTER USER '\''root'\''@'\''localhost'\'' IDENTIFIED VIA mysql_native_password USING PASSWORD('\'''\'')' -S /builddir/build/BUILD/mysql2-0.5.4/usr/share/gems/gems/mysql2-0.5.4/mysql.sock -P 13471
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/builddir/build/BUILD/mysql2-0.5.4/usr/share/gems/gems/mysql2-0.' (2)
~~~
After Michal Schorm <mschorm@redhat.com>'s investigation (thanks!), we found
the error comes from the not appropriate SSL configurations.
It was reported that in Fedora, the MariaDB 10.5.16 used downstream OpenSSL 3
patch, and the MariaDB 10.5.18 started to use upstream OpenSSL 3 patch.
And there are some differences between these two patch files. And the difference
triggered this issue.
See also <https://github.com/brianmario/mysql2/pull/1290>.
I also applied a patch to use the SSL pem files in the spec directory directly
to run the SSL tests. Because we can't set up the files in the `/etc/mysql`.
See also <https://github.com/brianmario/mysql2/pull/1293>.
I also regenerated the SSL certification files from the localhost. It requires
openssl as a build dependency. This is a temporary workaround. It is expected
that the certification files are managed in the upstream repository.
See also <https://github.com/brianmario/mysql2/pull/1296>.
Resolves: rhbz#2144488