File tree 1 file changed +40
-0
lines changed
1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change 95
95
)
96
96
end
97
97
end
98
+
99
+ context 'with an invalid install_secret_file path' do
100
+ let ( :params ) { { } }
101
+
102
+ [
103
+ '|| ls -la ||' ,
104
+ '|| touch /tmp/foo.txt ||' ,
105
+ '/tmp/foo.txt;echo' ,
106
+ 'myPath;' ,
107
+ '\\myPath\\' ,
108
+ '//myPath has spaces//' ,
109
+ '/' ,
110
+ '.secret_file' ,
111
+ ] . each do |path |
112
+ it do
113
+ params [ 'install_secret_file' ] = path
114
+ is_expected . to raise_error ( Puppet ::PreformattedError , %r{'#{ Regexp . escape ( path ) } ' is not a valid path.} )
115
+ end
116
+ end
117
+ end
118
+ end
119
+
120
+ context 'with a valid install_secret_file path' do
121
+ let ( :params ) { { } }
122
+
123
+ [
124
+ '/tmp/foo.txt' ,
125
+ '/foo.txt' ,
126
+ '/.secret_file' ,
127
+ ] . each do |path |
128
+ it do
129
+ params [ 'install_secret_file' ] = path
130
+ is_expected . to contain_exec ( 'remove install pass' )
131
+ . with (
132
+ command : "mysqladmin -u root --password=$(grep -o \' [^ ]\\ +$\' #{ path } ) password \' \' && rm -f #{ path } " ,
133
+ onlyif : "test -f #{ path } " ,
134
+ path : '/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin' ,
135
+ )
136
+ end
137
+ end
98
138
end
99
139
100
140
context 'mysql::server::service' do
You can’t perform that action at this time.
0 commit comments