|
196 | 196 | expect(ubuntu_10_04_custom_run).to write_log('notify reload')
|
197 | 197 | end
|
198 | 198 | end
|
| 199 | + |
| 200 | + context 'when using non-default package_version parameter' do |
| 201 | + let(:package_version) { '5.1.73-1.el6' } |
| 202 | + let(:ubuntu_10_04_custom_run) do |
| 203 | + ChefSpec::Runner.new( |
| 204 | + :step_into => 'mysql_service', |
| 205 | + :platform => 'ubuntu', |
| 206 | + :version => '10.04' |
| 207 | + ) do |node| |
| 208 | + node.set['mysql']['service_name'] = 'ubuntu_10_04_custom' |
| 209 | + node.set['mysql']['port'] = '3308' |
| 210 | + node.set['mysql']['data_dir'] = '/data' |
| 211 | + node.set['mysql']['template_source'] = 'custom.erb' |
| 212 | + node.set['mysql']['allow_remote_root'] = true |
| 213 | + node.set['mysql']['remove_anonymous_users'] = false |
| 214 | + node.set['mysql']['remove_test_database'] = false |
| 215 | + node.set['mysql']['root_network_acl'] = ['10.9.8.7/6', '1.2.3.4/5'] |
| 216 | + node.set['mysql']['server_root_password'] = 'YUNOSETPASSWORD' |
| 217 | + node.set['mysql']['server_debian_password'] = 'postinstallscriptsarestupid' |
| 218 | + node.set['mysql']['server_repl_password'] = 'syncmebabyonemoretime' |
| 219 | + node.set['mysql']['server_package_version'] = package_version |
| 220 | + end.converge('mysql_test_custom::server') |
| 221 | + end |
| 222 | + |
| 223 | + it 'creates mysql_service[ubuntu_10_04_custom] with correct package_version' do |
| 224 | + expect(ubuntu_10_04_custom_run).to create_mysql_service('ubuntu_10_04_custom').with( |
| 225 | + :parsed_version => '5.1', |
| 226 | + :parsed_port => '3308', |
| 227 | + :parsed_data_dir => '/data', |
| 228 | + :parsed_package_version => package_version |
| 229 | + ) |
| 230 | + end |
| 231 | + |
| 232 | + it 'steps into mysql_service and installs package[mysql-server-5.1]' do |
| 233 | + expect(ubuntu_10_04_custom_run).to install_package('mysql-server-5.1').with(:version => package_version) |
| 234 | + end |
| 235 | + end |
| 236 | + |
| 237 | + context 'when using non-default package_action parameter' do |
| 238 | + let(:package_action) { 'upgrade' } |
| 239 | + let(:ubuntu_10_04_custom_run) do |
| 240 | + ChefSpec::Runner.new( |
| 241 | + :step_into => 'mysql_service', |
| 242 | + :platform => 'ubuntu', |
| 243 | + :version => '10.04' |
| 244 | + ) do |node| |
| 245 | + node.set['mysql']['service_name'] = 'ubuntu_10_04_custom' |
| 246 | + node.set['mysql']['port'] = '3308' |
| 247 | + node.set['mysql']['data_dir'] = '/data' |
| 248 | + node.set['mysql']['template_source'] = 'custom.erb' |
| 249 | + node.set['mysql']['allow_remote_root'] = true |
| 250 | + node.set['mysql']['remove_anonymous_users'] = false |
| 251 | + node.set['mysql']['remove_test_database'] = false |
| 252 | + node.set['mysql']['root_network_acl'] = ['10.9.8.7/6', '1.2.3.4/5'] |
| 253 | + node.set['mysql']['server_root_password'] = 'YUNOSETPASSWORD' |
| 254 | + node.set['mysql']['server_debian_password'] = 'postinstallscriptsarestupid' |
| 255 | + node.set['mysql']['server_repl_password'] = 'syncmebabyonemoretime' |
| 256 | + node.set['mysql']['server_package_action'] = package_action |
| 257 | + end.converge('mysql_test_custom::server') |
| 258 | + end |
| 259 | + |
| 260 | + it 'creates mysql_service[ubuntu_10_04_custom] with correct package_action' do |
| 261 | + expect(ubuntu_10_04_custom_run).to create_mysql_service('ubuntu_10_04_custom').with( |
| 262 | + :parsed_version => '5.1', |
| 263 | + :parsed_port => '3308', |
| 264 | + :parsed_data_dir => '/data', |
| 265 | + :parsed_package_action => package_action |
| 266 | + ) |
| 267 | + end |
| 268 | + |
| 269 | + it 'steps into mysql_service and upgrades package[mysql-server-5.1]' do |
| 270 | + expect(ubuntu_10_04_custom_run).to upgrade_package('mysql-server-5.1') |
| 271 | + end |
| 272 | + end |
199 | 273 | end
|
0 commit comments