Skip to content

Commit 33211ed

Browse files
committed
(maint) fix mysql_login_path acceptance tests on arm
* remove the x86_64 binaries that should not have been added to the repo * mysql_login_path is not supported by MariaDB so skip related tests if the test host doesn't have the binary.
1 parent 459be93 commit 33211ed

File tree

8 files changed

+51
-52
lines changed

8 files changed

+51
-52
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ If required, the password can also be an empty string to allow connections witho
209209

210210
### Create login paths
211211

212-
This feature works only for the MySQL Community Edition >= 5.6.6.
212+
This feature works only for the MySQL Community Edition >= 5.6.6, [not MariaDB](https://mariadb.com/kb/en/mysql_config_editor-compatibility/).
213213

214214
A login path is a set of options (host, user, password, port and socket) that specify which MySQL server to connect to and which account to authenticate as. The authentication credentials and the other options are stored in an encrypted login file named .mylogin.cnf typically under the users home directory.
215215

spec/acceptance/types/mysql_login_path_spec.rb

+50-51
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,22 @@
22

33
require 'spec_helper_acceptance'
44

5-
support_bin_dir = '/root/mysql_login_path'
6-
mysql_version = if (os[:family] == 'redhat' && os[:release].to_i == 8) || (os[:family] == 'debian' && os[:release] =~ %r{9|10|11})
7-
'8.0'
8-
elsif os[:family] == 'ubuntu' && os[:release] =~ %r{18\.04|20\.04}
9-
'5.7'
10-
else
11-
'5.6'
12-
end
5+
describe 'mysql_login_path' do
6+
begin
7+
# mysql_config_editor is not supported on mariadb
8+
# all tests should be skipped
9+
run_shell('mysql_config_editor -V')
10+
rescue
11+
return
12+
end
1313

14-
describe 'mysql_login_path', unless: "#{os[:family]}-#{os[:release].to_i}".include?('suse') do
15-
before(:all) do
16-
run_shell("rm -rf #{support_bin_dir}")
17-
bolt_upload_file('spec/support/mysql_login_path', support_bin_dir)
18-
run_shell("cp #{support_bin_dir}/mysql-#{mysql_version}/my_print_defaults /usr/bin/.")
19-
run_shell("cp #{support_bin_dir}/mysql-#{mysql_version}/mysql_config_editor /usr/bin/.")
14+
let(:base_pp) do
15+
<<-MANIFEST
16+
user { 'loginpath_test':
17+
ensure => present,
18+
managehome => true,
19+
}
20+
MANIFEST
2021
end
2122

2223
after(:all) do
@@ -29,36 +30,13 @@
2930
}
3031
MANIFEST
3132
apply_manifest(pp_cleanup, catch_failures: true)
32-
run_shell("rm -rf #{support_bin_dir}")
33-
end
34-
35-
describe 'setup' do
36-
pp = <<-MANIFEST
37-
user { 'loginpath_test':
38-
ensure => present,
39-
managehome => true,
40-
}
41-
MANIFEST
42-
it 'works with no errors' do
43-
apply_manifest(pp, catch_failures: true)
44-
end
45-
46-
it 'finds mysql_config_editor binary for the provider' do
47-
run_shell('mysql_config_editor -V') do |r|
48-
expect(r.stdout).to match(%r{Ver.*#{mysql_version}.*x86_64})
49-
end
50-
end
51-
52-
it 'finds my_print_defaults binary for the provider' do
53-
run_shell('my_print_defaults -V') do |r|
54-
expect(r.exit_status).to eq(0)
55-
end
56-
end
5733
end
5834

5935
context 'for user root' do
6036
describe 'add login path' do
61-
pp = <<-MANIFEST
37+
let(:pp) do
38+
<<-MANIFEST
39+
#{base_pp}
6240
mysql_login_path { 'local_socket':
6341
owner => root,
6442
host => 'localhost',
@@ -75,7 +53,9 @@
7553
port => 3306,
7654
ensure => present,
7755
}
78-
MANIFEST
56+
MANIFEST
57+
end
58+
7959
it 'works without errors' do
8060
apply_manifest(pp, catch_failures: true)
8161
end
@@ -102,7 +82,9 @@
10282
end
10383

10484
describe 'update login path' do
105-
pp = <<-MANIFEST
85+
let(:pp) do
86+
<<-MANIFEST
87+
#{base_pp}
10688
mysql_login_path { 'local_tcp-root':
10789
owner => root,
10890
host => '10.0.0.1',
@@ -111,13 +93,18 @@
11193
port => 3307,
11294
ensure => present,
11395
}
114-
MANIFEST
115-
pp2 = <<-MANIFEST
96+
MANIFEST
97+
end
98+
99+
let(:pp2) do
100+
<<-MANIFEST
116101
mysql_login_path { 'local_tcp-root':
117102
ensure => present,
118103
host => '192.168.0.1'
119104
}
120-
MANIFEST
105+
MANIFEST
106+
end
107+
121108
it 'works without errors' do
122109
apply_manifest(pp, catch_failures: true)
123110
end
@@ -193,7 +180,9 @@
193180

194181
context 'for user loginpath_test' do
195182
describe 'add login path' do
196-
pp = <<-MANIFEST
183+
let(:pp) do
184+
<<-MANIFEST
185+
#{base_pp}
197186
mysql_login_path { 'local_tcp':
198187
owner => loginpath_test,
199188
host => '10.0.0.2',
@@ -202,7 +191,9 @@
202191
port => 3306,
203192
ensure => present,
204193
}
205-
MANIFEST
194+
MANIFEST
195+
end
196+
206197
it 'works without errors' do
207198
apply_manifest(pp, catch_failures: true)
208199
end
@@ -225,15 +216,19 @@
225216
end
226217

227218
describe 'update login path' do
228-
pp = <<-MANIFEST
219+
let(:pp) do
220+
<<-MANIFEST
221+
#{base_pp}
229222
mysql_login_path { 'local_tcp-loginpath_test':
230223
host => '10.0.0.3',
231224
user => 'other2',
232225
password => Sensitive('password'),
233226
port => 3307,
234227
ensure => present,
235228
}
236-
MANIFEST
229+
MANIFEST
230+
end
231+
237232
it 'works without errors' do
238233
apply_manifest(pp, catch_failures: true)
239234
end
@@ -256,12 +251,16 @@
256251
end
257252

258253
describe 'delete login path' do
259-
pp = <<-MANIFEST
254+
let(:pp) do
255+
<<-MANIFEST
256+
#{base_pp}
260257
mysql_login_path { 'local_tcp':
261258
owner => loginpath_test,
262259
ensure => absent,
263260
}
264-
MANIFEST
261+
MANIFEST
262+
end
263+
265264
it 'works without errors' do
266265
apply_manifest(pp, catch_failures: true)
267266
end
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)