Skip to content

Commit df4c7cd

Browse files
committed
Add spec tests
This commit adds spec tests for the changes made in the previous commit.
1 parent 51cf76b commit df4c7cd

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

spec/classes/mysql_server_spec.rb

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,8 @@
158158
describe 'when defaults' do
159159
it {
160160
is_expected.to contain_exec('remove install pass').with(
161-
command: 'mysqladmin -u root --password=$(grep -o \'[^ ]\\+$\' /.mysql_secret) password \'\' && rm -f /.mysql_secret',
162-
onlyif: 'test -f /.mysql_secret',
161+
command: "mysqladmin -u root --password=\$(grep -o '[^ ]\\+\$' /.mysql_secret) password && (rm -f /.mysql_secret; exit 0) || (rm -f /.mysql_secret; exit 1)",
162+
onlyif: [['test', '-f', '/.mysql_secret']],
163163
path: '/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin',
164164
)
165165
}
@@ -198,16 +198,6 @@
198198
it { is_expected.not_to contain_mysql_user('root@localhost') }
199199
it { is_expected.not_to contain_file('/root/.my.cnf') }
200200
end
201-
describe 'when install_secret_file set to /root/.mysql_secret' do
202-
let(:params) { { install_secret_file: '/root/.mysql_secret' } }
203-
204-
it {
205-
is_expected.to contain_exec('remove install pass').with(
206-
command: 'mysqladmin -u root --password=$(grep -o \'[^ ]\\+$\' /root/.mysql_secret) password \'\' && rm -f /root/.mysql_secret',
207-
onlyif: 'test -f /root/.mysql_secret',
208-
)
209-
}
210-
end
211201
end
212202

213203
context 'mysql::server::providers' do

0 commit comments

Comments
 (0)