Basic acceptance tests

Change-Id: I14799b09ccdf4d792328ba1de7a5581c528faa1e
This commit is contained in:
Spencer Krum 2015-07-28 02:27:29 -07:00
parent 8ecfcf2bf0
commit 8ccfb65197
3 changed files with 68 additions and 0 deletions

View File

@ -27,4 +27,8 @@ group :development, :test do
end
group :system_tests do
gem 'beaker-rspec', :require => false
end
# vim:ft=ruby

52
spec/acceptance/basic_spec.rb Executable file
View File

@ -0,0 +1,52 @@
require 'spec_helper_acceptance'
describe 'basic accessbot' do
if fact('osfamily') == 'Debian'
context 'default parameters' do
it 'should work with no errors' do
base_path = File.dirname(__FILE__)
pp_path = File.join(base_path, 'fixtures', 'default.pp')
pp = File.read(pp_path)
# Run it twice and test for idempotency
apply_manifest(pp, :catch_failures => true)
apply_manifest(pp, :catch_changes => true)
end
end
context 'installation of packages' do
describe package('python-yaml') do
it { should be_installed }
end
end
context 'files and directories' do
describe file('/etc/accessbot/accessbot.config') do
it { should be_file }
it { should be_owned_by 'root' }
it { should be_mode 440 }
it { should be_grouped_into 'accessbo' }
end
end
context 'main proccess' do
describe process("accessbot") do
its(:user) { should eq "accessbot" }
its(:args) { should match /-c accessbot.config/ }
end
end
end
end

View File

@ -0,0 +1,12 @@
file { '/etc/channels.yaml':
ensure => file,
content => 'channels:\n - name: openstack-rainbow-unicorn-pals',
}
class { '::accessbot':
nick => 'accessbot-test',
password => 'infraR4lez',
server => 'irc.freenode.net',
channel_file => '/etc/channels.yaml',
require => File['/etc/channels.yaml'],
}