Skip to content

Commit a6c0d92

Browse files
committed
FM-7783 cleanup mysql
1 parent 3a61aa8 commit a6c0d92

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

spec/acceptance/types/mysql_database_spec.rb

+1-2
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ class { 'mysql::server': }
4444
}
4545
MANIFEST
4646
it 'creates two db of different types idempotently' do
47-
execute_manifest(pp, catch_failures: true)
48-
execute_manifest(pp, catch_changes: true)
47+
idempotent_apply(default, pp, {})
4948
end
5049

5150
it 'finds latin1 db #stdout' do

spec/spec_helper_acceptance.rb

+14
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,20 @@
1616
install_module_on(hosts)
1717
install_module_dependencies_on(hosts)
1818

19+
def idempotent_apply(hosts, manifest, opts = {}, &block)
20+
block_on hosts, opts do |host|
21+
file_path = host.tmpfile('apply_manifest.pp')
22+
create_remote_file(host, file_path, manifest + "\n")
23+
24+
puppet_apply_opts = { :verbose => nil, 'detailed-exitcodes' => nil }
25+
on_options = { acceptable_exit_codes: [0, 2] }
26+
on host, puppet('apply', file_path, puppet_apply_opts), on_options, &block
27+
puppet_apply_opts2 = { :verbose => nil, 'detailed-exitcodes' => nil }
28+
on_options2 = { acceptable_exit_codes: [0] }
29+
on host, puppet('apply', file_path, puppet_apply_opts2), on_options2, &block
30+
end
31+
end
32+
1933
RSpec.configure do |c|
2034
# Readable test descriptions
2135
c.formatter = :documentation

spec/unit/puppet/type/mysql_user_spec.rb

+8
Original file line numberDiff line numberDiff line change
@@ -125,4 +125,12 @@
125125
}.to raise_error %r{Invalid database user "misquoted@localhost}
126126
end
127127
end
128+
129+
context 'using invalid options' do
130+
it 'fails with an invalid option' do
131+
expect {
132+
Puppet::Type.type(:mysql_user).new(name: 'misquoted@localhost', password_hash: 'pass', tls_options: ['SOMETHING_ELSE'])
133+
}.to raise_error %r{Invalid tls option}
134+
end
135+
end
128136
end

0 commit comments

Comments
 (0)