File tree 2 files changed +9
-4
lines changed
spec/unit/puppet/provider/mysql_user
2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ def mysqld_type
33
33
def self . mysqld_version_string
34
34
# we cache the result ...
35
35
return @mysqld_version_string unless @mysqld_version_string . nil?
36
- @mysqld_version_string = mysqld ( [ '-V' ] . compact )
36
+ @mysqld_version_string = Facter . value ( :mysqld_version )
37
37
return @mysqld_version_string
38
38
end
39
39
Original file line number Diff line number Diff line change 200
200
end
201
201
202
202
describe 'self.mysqld_version' do
203
- it 'queries mysql if unset' do
203
+ it 'uses the mysqld_version fact if unset' do
204
204
provider . class . instance_variable_set ( :@mysqld_version_string , nil )
205
- provider . class . expects ( :mysqld ) . with ( [ '-V' ] )
206
- expect ( provider . mysqld_version ) . to be_nil
205
+ Facter . stubs ( :value ) . with ( :mysqld_version ) . returns ( '5.6.24' )
206
+ expect ( provider . mysqld_version ) . to eq '5.6.24'
207
+ end
208
+ it 'returns nil if the mysqld_version fact is absent' do
209
+ provider . class . instance_variable_set ( :@mysqld_version_string , nil )
210
+ Facter . stubs ( :value ) . with ( :mysqld_version ) . returns ( nil )
211
+ expect ( provider . mysqld_version ) . to eq nil
207
212
end
208
213
it 'returns 5.7.6 for "mysqld Ver 5.7.6 for Linux on x86_64 (MySQL Community Server (GPL))"' do
209
214
provider . class . instance_variable_set ( :@mysqld_version_string , 'mysqld Ver 5.7.6 for Linux on x86_64 (MySQL Community Server (GPL))' )
You can’t perform that action at this time.
0 commit comments