File tree Expand file tree Collapse file tree 4 files changed +32
-10
lines changed Expand file tree Collapse file tree 4 files changed +32
-10
lines changed Original file line number Diff line number Diff line change 16
16
# Fedora latest stable version
17
17
- {distro: fedora, image: 'fedora:latest'}
18
18
# Fedora development version
19
- - {distro: fedora, image: 'fedora:rawhide'}
19
+ - {distro: fedora, image: 'fedora:rawhide', ssl_cert_dir: '/tmp/mysql2' }
20
20
# On the fail-fast: true, it cancels all in-progress jobs
21
21
# if any matrix job fails unlike Travis fast_finish.
22
22
fail-fast : false
27
27
# as a temporary workaround to avoid the following issue
28
28
# in the Fedora >= 34 containers.
29
29
# https://bugzilla.redhat.com/show_bug.cgi?id=1900021
30
- - run : docker run --add-host=mysql2gem.example.com:127.0.0.1 -t --cap-add=SYS_PTRACE --security-opt seccomp=unconfined mysql2
30
+ - run : |
31
+ docker run \
32
+ --add-host=mysql2gem.example.com:127.0.0.1 \
33
+ -t \
34
+ -e TEST_RUBY_MYSQL2_SSL_CERT_DIR="${{ matrix.ssl_cert_dir || '' }}" \
35
+ --cap-add=SYS_PTRACE --security-opt seccomp=unconfined \
36
+ mysql2
Original file line number Diff line number Diff line change 2
2
3
3
set -eux
4
4
5
+ # TEST_RUBY_MYSQL2_SSL_CERT_DIR: custom SSL certs directory.
6
+ SSL_CERT_DIR=${TEST_RUBY_MYSQL2_SSL_CERT_DIR:-/ etc/ mysql}
7
+
5
8
# Make sure there is an /etc/mysql
6
- mkdir -p /etc/mysql
9
+ mkdir -p " ${SSL_CERT_DIR} "
7
10
8
11
# Copy the local certs to /etc/mysql
9
- cp spec/ssl/* pem /etc/mysql/
12
+ cp spec/ssl/* pem " ${SSL_CERT_DIR} "
10
13
11
14
# Wherever MySQL configs live, go there (this is for cross-platform)
12
15
cd $( my_print_defaults --help | grep my.cnf | xargs find 2> /dev/null | xargs dirname)
13
16
14
17
# Put the configs into the server
15
18
echo "
16
19
[mysqld]
17
- ssl-ca=/etc/mysql /ca-cert.pem
18
- ssl-cert=/etc/mysql /server-cert.pem
19
- ssl-key=/etc/mysql /server-key.pem
20
+ ssl-ca=${SSL_CERT_DIR} /ca-cert.pem
21
+ ssl-cert=${SSL_CERT_DIR} /server-cert.pem
22
+ ssl-key=${SSL_CERT_DIR} /server-key.pem
20
23
" >> my.cnf
Original file line number Diff line number Diff line change @@ -154,9 +154,9 @@ def connect(*args)
154
154
let ( :option_overrides ) do
155
155
{
156
156
'host' => 'mysql2gem.example.com' , # must match the certificates
157
- :sslkey => '/etc/mysql/ client-key.pem' ,
158
- :sslcert => '/etc/mysql/ client-cert.pem' ,
159
- :sslca => '/etc/mysql/ ca-cert.pem' ,
157
+ :sslkey => " #{ ssl_cert_dir } / client-key.pem" ,
158
+ :sslcert => " #{ ssl_cert_dir } / client-cert.pem" ,
159
+ :sslca => " #{ ssl_cert_dir } / ca-cert.pem" ,
160
160
:sslcipher => 'DHE-RSA-AES256-SHA' ,
161
161
:sslverify => true ,
162
162
}
Original file line number Diff line number Diff line change @@ -60,6 +60,19 @@ def clock_time
60
60
end
61
61
end
62
62
63
+ # A directory where SSL certificates pem files exist.
64
+ def ssl_cert_dir
65
+ return @ssl_cert_dir if @ssl_cert_dir
66
+
67
+ dir = ENV [ 'TEST_RUBY_MYSQL2_SSL_CERT_DIR' ]
68
+ @ssl_cert_dir = if dir && !dir . empty?
69
+ dir
70
+ else
71
+ '/etc/mysql'
72
+ end
73
+ @ssl_cert_dir
74
+ end
75
+
63
76
config . before ( :suite ) do
64
77
begin
65
78
new_client
You can’t perform that action at this time.
0 commit comments