From 8ccfb651975f88e8ca7a128bfd520cb014ffb77c Mon Sep 17 00:00:00 2001 From: Spencer Krum Date: Tue, 28 Jul 2015 02:27:29 -0700 Subject: [PATCH] Basic acceptance tests Change-Id: I14799b09ccdf4d792328ba1de7a5581c528faa1e --- Gemfile | 4 +++ spec/acceptance/basic_spec.rb | 52 +++++++++++++++++++++++++++++ spec/acceptance/fixtures/default.pp | 12 +++++++ 3 files changed, 68 insertions(+) create mode 100755 spec/acceptance/basic_spec.rb create mode 100644 spec/acceptance/fixtures/default.pp diff --git a/Gemfile b/Gemfile index 96912da..1d021a1 100644 --- a/Gemfile +++ b/Gemfile @@ -27,4 +27,8 @@ group :development, :test do end +group :system_tests do + gem 'beaker-rspec', :require => false +end + # vim:ft=ruby diff --git a/spec/acceptance/basic_spec.rb b/spec/acceptance/basic_spec.rb new file mode 100755 index 0000000..8b96041 --- /dev/null +++ b/spec/acceptance/basic_spec.rb @@ -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 diff --git a/spec/acceptance/fixtures/default.pp b/spec/acceptance/fixtures/default.pp new file mode 100644 index 0000000..79ce4db --- /dev/null +++ b/spec/acceptance/fixtures/default.pp @@ -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'], +}