Skip to content

Commit 3a94a5f

Browse files
committed
(maint) Add tests to verify mariadb
1 parent a221327 commit 3a94a5f

File tree

2 files changed

+44
-1
lines changed

2 files changed

+44
-1
lines changed

manifests/server/config.pp

-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@
5555
}
5656
}
5757
}
58-
default: {}
5958
}
6059

6160
if $mysql::server::manage_config_file {

spec/acceptance/mysql_mariadb_spec.rb

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
require 'spec_helper_acceptance'
2+
3+
describe 'mysql server class' do
4+
describe 'mariadb' do
5+
let(:pp) do
6+
<<-MANIFEST
7+
$osname = $facts['os']['name'].downcase
8+
yumrepo {'mariadb':
9+
baseurl => "http://yum.mariadb.org/10.4/$osname${facts['os']['release']['major']}-aarch64/",
10+
gpgkey => 'https://yum.mariadb.org/RPM-GPG-KEY-MariaDB',
11+
descr => "MariaDB 10.4",
12+
enabled => 1,
13+
gpgcheck => 1,
14+
}->
15+
class { '::mysql::server':
16+
require => Yumrepo['mariadb'],
17+
package_name => 'mariadb-server',
18+
service_name => 'mariadb',
19+
root_password => 'strongpassword',
20+
remove_default_accounts => true,
21+
managed_dirs => ['/var/log','/var/run/mysql'],
22+
override_options => {
23+
mysqld => {
24+
log-error => '/var/log/mariadb.log',
25+
pid-file => '/var/run/mysql/mysqld.pid',
26+
},
27+
mysqld_safe => {
28+
log-error => '/var/log/mariadb.log',
29+
},
30+
},
31+
}
32+
MANIFEST
33+
end
34+
35+
it 'apply manifest' do
36+
apply_manifest(pp)
37+
end
38+
it 'mariadb connection' do
39+
result = run_shell('mysql --user="root" --password="strongpassword" -e "status"')
40+
expect(result.stdout).to match(%r{MariaDB})
41+
expect(result.stderr).to be_empty
42+
end
43+
end
44+
end

0 commit comments

Comments
 (0)