forked from puppetlabs/puppetlabs-mysql
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmysql_mariadb_spec.rb
46 lines (43 loc) · 1.55 KB
/
mysql_mariadb_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# frozen_string_literal: true
require 'spec_helper_acceptance'
describe 'mysql server class', if: ((os[:family] == 'debian' && os[:release].to_i > 8) || (os[:family] == 'redhat' && os[:release].to_i > 6)) do
describe 'mariadb' do
let(:pp) do
<<-MANIFEST
$osname = $facts['os']['name'].downcase
yumrepo {'mariadb':
baseurl => "http://yum.mariadb.org/10.4/$osname${facts['os']['release']['major']}-aarch64/",
gpgkey => 'https://yum.mariadb.org/RPM-GPG-KEY-MariaDB',
descr => "MariaDB 10.4",
enabled => 1,
gpgcheck => 1,
}->
class { '::mysql::server':
require => Yumrepo['mariadb'],
package_name => 'mariadb-server',
service_name => 'mariadb',
root_password => 'strongpassword',
remove_default_accounts => true,
managed_dirs => ['/var/log','/var/run/mysql'],
override_options => {
mysqld => {
log-error => '/var/log/mariadb.log',
pid-file => '/var/run/mysql/mysqld.pid',
},
mysqld_safe => {
log-error => '/var/log/mariadb.log',
},
},
}
MANIFEST
end
it 'apply manifest' do
apply_manifest(pp)
end
it 'mariadb connection' do
result = run_shell('mysql --user="root" --password="strongpassword" -e "status"')
expect(result.stdout).to match(%r{MariaDB})
expect(result.stderr).to be_empty
end
end
end