Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated to 3.4.2 release #166

Merged
merged 17 commits into from
Dec 2, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ provisioner:
name: chef_zero

platforms:
- name: centos-5.10
- name: centos-6.5
- name: ubuntu-12.04
- name: ubuntu-14.04
Expand Down
2 changes: 1 addition & 1 deletion Berksfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
site :opscode
source 'https://supermarket.getchef.com'

metadata

Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ rabbitmq Cookbook CHANGELOG
===========================
This file is used to list changes made in each version of the rabbitmq cookbook.

v3.5.0 (2014-11-26)
-------------------
Updated for the new release of RabbitMQ release 3.4.2
Removed the Centos 5.10 from integration testing
Updated the Gemfile for testing

v3.4.0 (2014-11-23)
-------------------
- Updated the RuboCop camel case
Expand Down
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ source 'https://rubygems.org'

group :lint do
gem 'foodcritic', '~> 4.0'
gem 'rubocop', '~> 0.18'
gem 'rubocop', '~> 0.23'
gem 'rainbow', '< 2.0'
end

group :unit do
gem 'berkshelf'
gem 'chefspec'
gem 'fauxhai'
end

group :kitchen_common do
Expand Down
5 changes: 4 additions & 1 deletion attributes/default.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Latest RabbitMQ.com version to install
default['rabbitmq']['version'] = '3.3.5'
default['rabbitmq']['version'] = '3.4.2'
# The distro versions may be more stable and have back-ported patches
default['rabbitmq']['use_distro_version'] = false

Expand Down Expand Up @@ -103,3 +103,6 @@
default['rabbitmq']['policies']['ha-two']['priority'] = 1

default['rabbitmq']['disabled_policies'] = []

# conf
default['rabbitmq']['conf'] = {}
2 changes: 1 addition & 1 deletion recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ class Chef::Resource # rubocop:disable all
notifies :restart, "service[#{node['rabbitmq']['service_name']}]", :immediately
end

if File.exist?(node['rabbitmq']['erlang_cookie_path'])
if File.exist?(node['rabbitmq']['erlang_cookie_path']) && File.readable?((node['rabbitmq']['erlang_cookie_path']))
existing_erlang_key = File.read(node['rabbitmq']['erlang_cookie_path']).strip
else
existing_erlang_key = ''
Expand Down
1 change: 0 additions & 1 deletion recipes/plugin_management.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,5 @@
node['rabbitmq']['disabled_plugins'].each do |plugin|
rabbitmq_plugin plugin do
action :disable
notifies :restart, "service[#{node['rabbitmq']['service_name']}]"
end
end
57 changes: 57 additions & 0 deletions spec/default_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
require 'spec_helper'

describe 'rabbitmq::default' do

version = '3.4.2-1'

let(:chef_run) do
ChefSpec::ServerRunner.new.converge(described_recipe)
end

let(:file_cache_path) { Chef::Config[:file_cache_path] }

it 'creates a directory for mnesiadir' do
expect(chef_run).to create_directory('/var/lib/rabbitmq/mnesia')
end

it 'creates a template rabbitmq-env.conf with attributes' do
expect(chef_run).to create_template('/etc/rabbitmq/rabbitmq-env.conf').with(
:user => 'root',
:group => 'root',
:source => 'rabbitmq-env.conf.erb',
:mode => 00644)
end

it 'should create the directory /var/lib/rabbitmq/mnesia' do
expect(chef_run).to create_directory('/var/lib/rabbitmq/mnesia').with(
:user => 'rabbitmq',
:group => 'rabbitmq',
:mode => '775'
)
end

it 'enables a rabbitmq service' do
expect(chef_run).to enable_service('rabbitmq-server')
end

it 'start a rabbitmq service' do
expect(chef_run).to start_service('rabbitmq-server')
end

it 'creates a rabbitmq-server rpm in the cache path' do
expect(chef_run).to create_remote_file_if_missing("#{Chef::Config[:file_cache_path]}/rabbitmq-server-#{version}.noarch.rpm")
end

it 'installs the rabbitmq-server rpm_package with the default action' do
expect(chef_run).to install_rpm_package("#{Chef::Config[:file_cache_path]}/rabbitmq-server-#{version}.noarch.rpm")
end

it 'creates a template rabbitmq.config with attributes' do
expect(chef_run).to create_template('/etc/rabbitmq/rabbitmq.config').with(
:user => 'root',
:group => 'root',
:source => 'rabbitmq.config.erb',
:mode => 00644)
end

end
14 changes: 14 additions & 0 deletions spec/mgmt_console_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
require 'spec_helper'

describe 'rabbitmq::mgmt_console' do
let(:chef_run) do
ChefSpec::ServerRunner.new.converge(described_recipe)
end

let(:file_cache_path) { Chef::Config[:file_cache_path] }

it 'includes the `default` recipe' do
expect(chef_run).to include_recipe('rabbitmq::default')
end

end
14 changes: 14 additions & 0 deletions spec/plugin_management_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
require 'spec_helper'

describe 'rabbitmq::plugin_management' do
let(:chef_run) do
ChefSpec::ServerRunner.new.converge(described_recipe)
end

let(:file_cache_path) { Chef::Config[:file_cache_path] }

it 'includes the `default` recipe' do
expect(chef_run).to include_recipe('rabbitmq::default')
end

end
14 changes: 14 additions & 0 deletions spec/policy_management_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
require 'spec_helper'

describe 'rabbitmq::policy_management' do
let(:chef_run) do
ChefSpec::ServerRunner.new.converge(described_recipe)
end

let(:file_cache_path) { Chef::Config[:file_cache_path] }

it 'includes the `default` recipe' do
expect(chef_run).to include_recipe('rabbitmq::default')
end

end
7 changes: 6 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
require 'chefspec'
require 'chefspec/berkshelf'
require 'fauxhai'
ChefSpec::Coverage.start!

at_exit { ChefSpec::Coverage.report! }
RSpec.configure do |config|
config.platform = 'redhat'
config.version = '6.5'
end
18 changes: 18 additions & 0 deletions spec/user_management_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
require 'spec_helper'

describe 'rabbitmq::user_management' do
let(:chef_run) do
ChefSpec::ServerRunner.new.converge(described_recipe)
end

let(:file_cache_path) { Chef::Config[:file_cache_path] }

it 'includes the `default` recipe' do
expect(chef_run).to include_recipe('rabbitmq::default')
end

it 'includes the `virtualhost_management` recipe' do
expect(chef_run).to include_recipe('rabbitmq::virtualhost_management')
end

end
14 changes: 14 additions & 0 deletions spec/virtualhost_management_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
require 'spec_helper'

describe 'rabbitmq::virtualhost_management' do
let(:chef_run) do
ChefSpec::ServerRunner.new.converge(described_recipe)
end

let(:file_cache_path) { Chef::Config[:file_cache_path] }

it 'includes the `default` recipe' do
expect(chef_run).to include_recipe('rabbitmq::default')
end

end
3 changes: 3 additions & 0 deletions templates/default/rabbitmq.config.erb
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,7 @@
{default_pass, <<"<%= node['rabbitmq']['default_pass'] %>">>},
{heartbeat, <%= node['rabbitmq']['heartbeat'] %>}
]}
<% node['rabbitmq']['conf'].each do |key,value| -%>
,{<%= key %>, <%= value %>}
<% end -%>
].