Skip to content

Commit

Permalink
[COOK-2151] - add tests for new feature.
Browse files Browse the repository at this point in the history
* Found issue in the template via testing :D
* Add cook-2151 configuration with matching tests
  • Loading branch information
jtimberman committed Jan 8, 2013
1 parent f1a49e8 commit eb9ce30
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 2 deletions.
2 changes: 1 addition & 1 deletion templates/default/rabbitmq.config.erb
Expand Up @@ -19,7 +19,7 @@
{disk_free_limit, {mem_relative, <%= node['rabbitmq']['disk_free_limit_relative'] %>}},
<% end %>
<% if node['rabbitmq']['vm_memory_high_watermark'] -%>
{vm_memory_high_watermark, <%= node['rabbitmq']['disk_free_limit_relative'] %>},
{vm_memory_high_watermark, <%= node['rabbitmq']['vm_memory_high_watermark'] %>},
<% end %>
{default_user, <<"<%= node['rabbitmq']['default_user'] %>">>},
{default_pass, <<"<%= node['rabbitmq']['default_pass'] %>">>}
Expand Down
1 change: 1 addition & 0 deletions test/kitchen/Kitchenfile
Expand Up @@ -20,4 +20,5 @@ cookbook "rabbitmq" do
configuration "mgmt_console"
configuration "cook-1684"
configuration "cook-1724"
configuration "cook-2151"
end
@@ -0,0 +1,31 @@
#
# Copyright 2012, Opscode, Inc. <legal@opscode.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

describe "rabbitmq_test::cook-2151" do
include MiniTest::Chef::Assertions
include MiniTest::Chef::Context
include MiniTest::Chef::Resources

it 'includes the disk_free_limit configuration setting' do
file("#{node['rabbitmq']['config_root']}/rabbitmq.config").
must_match /\{disk_free_limit, \{mem_relative, #{node['rabbitmq']['disk_free_limit_relative']}/
end

it 'includes the vm_memory_high_watermark configuration setting' do
file("#{node['rabbitmq']['config_root']}/rabbitmq.config").
must_match /\{vm_memory_high_watermark, #{node['rabbitmq']['vm_memory_high_watermark']}/
end
end
2 changes: 1 addition & 1 deletion test/kitchen/cookbooks/rabbitmq_test/recipes/cook-1684.rb
@@ -1,6 +1,6 @@
#
# Cookbook Name:: rabbitmq_test
# Recipe:: default
# Recipe:: cook-1684
#
# Copyright 2012, Opscode, Inc. <legal@opscode.com>
#
Expand Down
26 changes: 26 additions & 0 deletions test/kitchen/cookbooks/rabbitmq_test/recipes/cook-2151.rb
@@ -0,0 +1,26 @@
#
# Cookbook Name:: rabbitmq_test
# Recipe:: cook-2151
#
# Copyright 2012, Opscode, Inc. <legal@opscode.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

node.set['rabbitmq']['disk_free_limit_relative'] = 1.0
node.set['rabbitmq']['vm_memory_high_watermark'] = 0.5

log "#{cookbook_name}::#{recipe_name} tests that COOK-2151 is implemented."

include_recipe "yum::epel" if node['platform_family'] == 'rhel'
include_recipe "rabbitmq::default"

0 comments on commit eb9ce30

Please sign in to comment.