Skip to content

Commit a5f470a

Browse files
author
Sean OMeara
committed
Adding more tests: setting nondefault passwords in custom recipes, adding test wrapper cookbook
1 parent 592abba commit a5f470a

File tree

11 files changed

+61
-6
lines changed

11 files changed

+61
-6
lines changed

.kitchen.cloud.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ suites:
179179
version: '5.0'
180180
port: '3308'
181181
data_dir: '/data'
182+
server_root_password: 'nondefault'
182183

183184
#
184185
# server5.1
@@ -213,6 +214,7 @@ suites:
213214
version: '5.1'
214215
port: '3308'
215216
data_dir: '/data'
217+
server_root_password: 'nondefault'
216218

217219
#
218220
# server5.5
@@ -259,6 +261,7 @@ suites:
259261
version: '5.5'
260262
port: '3308'
261263
data_dir: '/data'
264+
server_root_password: 'nondefault'
262265

263266
#
264267
# server56
@@ -294,3 +297,14 @@ suites:
294297
version: '5.6'
295298
port: '3308'
296299
data_dir: '/data'
300+
server_root_password: 'nondefault'
301+
302+
#
303+
# wrapper test
304+
#
305+
- name: server-wrapper
306+
run_list:
307+
- recipe[mysql_test_wrapper::server]
308+
includes: [
309+
'ubuntu-14.04',
310+
]

Berksfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ end
1111

1212
cookbook 'mysql_test_default', path: 'test/fixtures/cookbooks/mysql_test_default'
1313
cookbook 'mysql_test_custom', path: 'test/fixtures/cookbooks/mysql_test_custom'
14+
cookbook 'mysql_test_wrapper', path: 'test/fixtures/cookbooks/mysql_test_wrapper'
1415
cookbook 'mysql_client_test', path: 'test/fixtures/cookbooks/mysql_client_test'
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
test cookbook
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
name 'mysql_test_wrapper'
2+
version '0.0.1'
3+
4+
depends 'mysql'
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#
2+
3+
node.set['mysql']['server_root_password'] = 'yolo'
4+
node.set['mysql']['port'] = '3308'
5+
node.set['mysql']['data_dir'] = '/data'
6+
7+
include_recipe 'mysql::server'
8+
9+
template '/etc/mysql/conf.d/mysite.cnf' do
10+
owner 'mysql'
11+
owner 'mysql'
12+
source 'mysite.cnf.erb'
13+
notifies :restart, 'mysql_service[default]'
14+
end
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# hello there
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
require 'serverspec'
2+
3+
include Serverspec::Helper::Exec
4+
include Serverspec::Helper::DetectOS
5+
6+
property[:os] = backend.check_os
7+
os = property[:os][:family]
8+
9+
if os =~ /Solaris/
10+
File.open('/etc/release').each do |l|
11+
next unless l =~ /OmniOS/
12+
describe command("/opt/mysql56/bin/mysql -u root -pyolo -e 'show databases;'") do
13+
it { should return_exit_status 0 }
14+
end
15+
end
16+
else
17+
describe command("mysql -u root -pyolo -e 'show databases;'") do
18+
it { should return_exit_status 0 }
19+
end
20+
end

test/integration/server50-custom/serverspec/assert_functioning_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
include Serverspec::Helper::Exec
44

5-
describe command("mysql -u root -pilikerandompasswords -e 'show databases;'") do
5+
describe command("mysql -u root -pnondefault -e 'show databases;'") do
66
it { should return_exit_status 0 }
77
end

test/integration/server51-custom/serverspec/assert_functioning_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
include Serverspec::Helper::Exec
44

5-
describe command("mysql -u root -pilikerandompasswords -e 'show databases;'") do
5+
describe command("mysql -u root -pnondefault -e 'show databases;'") do
66
it { should return_exit_status 0 }
77
end

test/integration/server55-custom/serverspec/assert_functioning_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
if os =~ /Solaris/
1010
File.open('/etc/release').each do |l|
1111
next unless l =~ /OmniOS/
12-
describe command("/opt/mysql55/bin/mysql -u root -pilikerandompasswords -e 'show databases;'") do
12+
describe command("/opt/mysql55/bin/mysql -u root -pnondefault -e 'show databases;'") do
1313
it { should return_exit_status 0 }
1414
end
1515
end
1616
else
17-
describe command("mysql -u root -pilikerandompasswords -e 'show databases;'") do
17+
describe command("mysql -u root -pnondefault -e 'show databases;'") do
1818
it { should return_exit_status 0 }
1919
end
2020
end

0 commit comments

Comments
 (0)