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

Added Three different os supports #186

Merged
merged 6 commits into from
Dec 16, 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
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ source 'https://rubygems.org'

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

Expand Down
4 changes: 3 additions & 1 deletion spec/community_plugins.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
require 'spec_helper'

describe 'rabbitmq::community_plugins' do
let(:runner) { ChefSpec::ServerRunner.new(REDHAT_OPTS) }
let(:node) { runner.node }
let(:chef_run) do
ChefSpec::ServerRunner.new.converge(described_recipe)
runner.converge(described_recipe)
end

let(:file_cache_path) { Chef::Config[:file_cache_path] }
Expand Down
84 changes: 78 additions & 6 deletions spec/default_spec.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
require 'spec_helper'

describe 'rabbitmq::default' do
version = '3.4.2-1'
let(:runner) { ChefSpec::ServerRunner.new(REDHAT_OPTS) }
let(:node) { runner.node }

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

let(:file_cache_path) { Chef::Config[:file_cache_path] }
Expand Down Expand Up @@ -37,12 +38,83 @@
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")
it 'should have the use_distro_version set to false' do
expect(chef_run.node['rabbitmq']['use_distro_version']).to eq(false)
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")
it 'should install the erlang package' do
expect(chef_run).to install_package('erlang')
end

describe 'suse' do
let(:runner) { ChefSpec::ServerRunner.new(SUSE_OPTS) }
let(:node) { runner.node }
let(:chef_run) do
runner.converge(described_recipe)
end

it 'should install the rabbitmq package' do
expect(chef_run).to install_package('rabbitmq-server')
end

it 'should install the rabbitmq plugin package' do
expect(chef_run).to install_package('rabbitmq-server-plugins')
end
end

describe 'debian-use_distro_version' do
let(:runner) { ChefSpec::ServerRunner.new(UBUNTU_OPTS) }
let(:node) { runner.node }
let(:chef_run) do
node.set['rabbitmq']['use_distro_version'] = true
runner.converge(described_recipe)
end

it 'should install the logrotate package' do
expect(chef_run).to install_package('logrotate')
end

it 'should install the rabbitmq distro package' do
expect(chef_run).to install_package('rabbitmq-server')
end
end

describe 'debian' do
let(:runner) { ChefSpec::ServerRunner.new(UBUNTU_OPTS) }
let(:node) { runner.node }
let(:chef_run) do
node.set['rabbitmq']['version'] = '3.4.2'
runner.converge(described_recipe)
end

it 'should install the logrotate package' do
expect(chef_run).to install_package('logrotate')
end

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

it 'installs the rabbitmq-server deb_package with the default action' do
expect(chef_run).to install_dpkg_package("#{Chef::Config[:file_cache_path]}/rabbitmq-server_#{node['rabbitmq']['version']}-1_all.deb")
end
end

describe 'redhat' do
let(:runner) { ChefSpec::ServerRunner.new(REDHAT_OPTS) }
let(:node) { runner.node }
let(:chef_run) do
node.set['rabbitmq']['version'] = '3.4.2'
runner.converge(described_recipe)
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-#{node['rabbitmq']['version']}-1.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-#{node['rabbitmq']['version']}-1.noarch.rpm")
end
end

it 'creates a template rabbitmq.config with attributes' do
Expand Down
4 changes: 3 additions & 1 deletion spec/mgmt_console_spec.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
require 'spec_helper'

describe 'rabbitmq::mgmt_console' do
let(:runner) { ChefSpec::ServerRunner.new(REDHAT_OPTS) }
let(:node) { runner.node }
let(:chef_run) do
ChefSpec::ServerRunner.new.converge(described_recipe)
runner.converge(described_recipe)
end

let(:file_cache_path) { Chef::Config[:file_cache_path] }
Expand Down
4 changes: 3 additions & 1 deletion spec/plugin_management_spec.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
require 'spec_helper'

describe 'rabbitmq::plugin_management' do
let(:runner) { ChefSpec::ServerRunner.new(REDHAT_OPTS) }
let(:node) { runner.node }
let(:chef_run) do
ChefSpec::ServerRunner.new.converge(described_recipe)
runner.converge(described_recipe)
end

let(:file_cache_path) { Chef::Config[:file_cache_path] }
Expand Down
4 changes: 3 additions & 1 deletion spec/policy_management_spec.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
require 'spec_helper'

describe 'rabbitmq::policy_management' do
let(:runner) { ChefSpec::ServerRunner.new(REDHAT_OPTS) }
let(:node) { runner.node }
let(:chef_run) do
ChefSpec::ServerRunner.new.converge(described_recipe)
runner.converge(described_recipe)
end

let(:file_cache_path) { Chef::Config[:file_cache_path] }
Expand Down
28 changes: 24 additions & 4 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,29 @@
# Encoding: utf-8
require 'chefspec'
require 'chefspec/berkshelf'
require 'fauxhai'
ChefSpec::Coverage.start!

RSpec.configure do |config|
config.platform = 'redhat'
config.version = '6.5'
end
require 'chef/application'

LOG_LEVEL = :fatal
SUSE_OPTS = {
:platform => 'suse',
:version => '11.3',
:log_level => LOG_LEVEL
}
REDHAT_OPTS = {
:platform => 'redhat',
:version => '6.5',
:log_level => LOG_LEVEL
}
UBUNTU_OPTS = {
:platform => 'ubuntu',
:version => '12.04',
:log_level => LOG_LEVEL
}
CENTOS_OPTS = {
:platform => 'centos',
:version => '6.5',
:log_level => LOG_LEVEL
}
4 changes: 3 additions & 1 deletion spec/user_management_spec.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
require 'spec_helper'

describe 'rabbitmq::user_management' do
let(:runner) { ChefSpec::ServerRunner.new(REDHAT_OPTS) }
let(:node) { runner.node }
let(:chef_run) do
ChefSpec::ServerRunner.new.converge(described_recipe)
runner.converge(described_recipe)
end

let(:file_cache_path) { Chef::Config[:file_cache_path] }
Expand Down
4 changes: 3 additions & 1 deletion spec/virtualhost_management_spec.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
require 'spec_helper'

describe 'rabbitmq::virtualhost_management' do
let(:runner) { ChefSpec::ServerRunner.new(REDHAT_OPTS) }
let(:node) { runner.node }
let(:chef_run) do
ChefSpec::ServerRunner.new.converge(described_recipe)
runner.converge(described_recipe)
end

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