Skip to content

Commit

Permalink
Merge pull request #138 from kennonkwok/tests-update-serverspec
Browse files Browse the repository at this point in the history
test-kitchen updates - porting to serverspec, added cluster suites
  • Loading branch information
smford22 committed Aug 28, 2014
2 parents 58df058 + 655e871 commit 40636e0
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 5 deletions.
8 changes: 7 additions & 1 deletion .kitchen.yml
Expand Up @@ -13,5 +13,11 @@ platforms:
suites:
- name: default
run_list:
- recipe[minitest-handler]
- recipe[rabbitmq::default]
- name: cluster
run_list:
- recipe[rabbitmq::default]
attributes:
rabbitmq:
cluster: true
cluster_disk_nodes: ['rabbit@localhost']
1 change: 1 addition & 0 deletions Gemfile
Expand Up @@ -34,4 +34,5 @@ group :development do
gem 'guard-rspec'
gem 'guard-rubocop'
gem 'rake'
gem 'stove'
end
2 changes: 1 addition & 1 deletion attributes/default.rb
@@ -1,5 +1,5 @@
# Latest RabbitMQ.com version to install
default['rabbitmq']['version'] = '3.1.5'
default['rabbitmq']['version'] = '3.3.5'
# The distro versions may be more stable and have back-ported patches
default['rabbitmq']['use_distro_version'] = false

Expand Down
10 changes: 10 additions & 0 deletions test/integration/cluster/serverspec/cluster_spec.rb
@@ -0,0 +1,10 @@
require 'spec_helper'

describe file('/var/lib/rabbitmq/.erlang.cookie') do
it { should be_file }
end

describe file('/etc/rabbitmq/rabbitmq.config') do
it { should be_file }
its(:content) { should match /^ {cluster_nodes, {.*}},$/ }
end
3 changes: 0 additions & 3 deletions test/integration/default/bats/rabbitmqctl_status.bats

This file was deleted.

1 change: 1 addition & 0 deletions test/integration/default/serverspec/default_spec.rb
@@ -0,0 +1 @@
require 'spec_helper'
37 changes: 37 additions & 0 deletions test/integration/helpers/serverspec/rabbitmq_spec.rb
@@ -0,0 +1,37 @@
require 'spec_helper'

describe package('rabbitmq-server') do
it { should be_installed }
end

describe service('rabbitmq-server') do
it { should be_enabled }
it { should be_running }
end

describe port(5672) do
it { should be_listening }
end

describe command('rabbitmqctl status') do
it { should return_exit_status 0 }
end

describe file('/var/lib/rabbitmq/mnesia') do
it { should be_directory }
it { should be_mode 775 }
it { should be_owned_by 'rabbitmq' }
it { should be_grouped_into 'rabbitmq' }
end

describe file('/etc/rabbitmq/rabbitmq-env.conf') do
it { should be_file }
it { should be_owned_by 'root' }
it { should be_grouped_into 'root' }
end

describe file('/etc/rabbitmq/rabbitmq.config') do
it { should be_file }
it { should be_owned_by 'root' }
it { should be_grouped_into 'root' }
end
13 changes: 13 additions & 0 deletions test/integration/helpers/serverspec/spec_helper.rb
@@ -0,0 +1,13 @@
require 'serverspec'

include SpecInfra::Helper::Exec
include SpecInfra::Helper::DetectOS

RSpec.configure do |c|
if ENV['ASK_SUDO_PASSWORD']
require 'highline/import'
c.sudo_password = ask("Enter sudo password: ") { |q| q.echo = false }
else
c.sudo_password = ENV['SUDO_PASSWORD']
end
end

0 comments on commit 40636e0

Please sign in to comment.