From 91ae01bd358ea0696a865c88207e61daafe7cd8a Mon Sep 17 00:00:00 2001 From: Adam Jahn Date: Mon, 7 Dec 2015 16:16:58 -0500 Subject: implement acceptance tests --- Rakefile | 1 + spec/acceptance/basic_samba_spec.rb | 35 ++++++++++++++++++++++ spec/acceptance/nodesets/centos-66-x64.yml | 12 ++++++++ spec/acceptance/nodesets/centos-70-x64.yml | 12 ++++++++ spec/acceptance/nodesets/debian-78-x64.yml | 12 ++++++++ .../acceptance/nodesets/ubuntu-server-1204-x86.yml | 13 ++++++++ .../acceptance/nodesets/ubuntu-server-1404-x64.yml | 13 ++++++++ spec/spec_helper_acceptance.rb | 29 ++++++++++++++++++ 8 files changed, 127 insertions(+) create mode 100644 spec/acceptance/basic_samba_spec.rb create mode 100644 spec/acceptance/nodesets/centos-66-x64.yml create mode 100644 spec/acceptance/nodesets/centos-70-x64.yml create mode 100644 spec/acceptance/nodesets/debian-78-x64.yml create mode 100644 spec/acceptance/nodesets/ubuntu-server-1204-x86.yml create mode 100644 spec/acceptance/nodesets/ubuntu-server-1404-x64.yml create mode 100644 spec/spec_helper_acceptance.rb diff --git a/Rakefile b/Rakefile index 69fed1b..908647f 100644 --- a/Rakefile +++ b/Rakefile @@ -28,6 +28,7 @@ exclude_paths = [ PuppetLint.configuration.ignore_paths = exclude_paths PuppetSyntax.exclude_paths = exclude_paths +ENV['BEAKER_set'] ||= 'ubuntu-server-1204-x86' desc "Run acceptance tests" RSpec::Core::RakeTask.new(:acceptance) do |t| t.pattern = 'spec/acceptance' diff --git a/spec/acceptance/basic_samba_spec.rb b/spec/acceptance/basic_samba_spec.rb new file mode 100644 index 0000000..0dd6ac6 --- /dev/null +++ b/spec/acceptance/basic_samba_spec.rb @@ -0,0 +1,35 @@ +require 'spec_helper_acceptance' + +describe 'basic samba' do + context 'default parameters' do + let(:pp) {" + class { 'samba::server': + workgroup => 'example', + server_string => 'Example Samba Server' + } + + samba::server::share {'example-share': + comment => 'Example Share', + path => '/path/to/share', + guest_only => true, + guest_ok => true, + guest_account => 'guest', + browsable => false, + create_mask => 0777, + force_create_mask => 0777, + directory_mask => 0777, + force_directory_mask => 0777, + force_group => 'group', + force_user => 'user', + } + "} + + it 'should apply with no errors' do + apply_manifest(pp, :catch_failures=>true) + end + + it 'should be idempotent' do + apply_manifest(pp, :catch_changes=>true) + end + end +end diff --git a/spec/acceptance/nodesets/centos-66-x64.yml b/spec/acceptance/nodesets/centos-66-x64.yml new file mode 100644 index 0000000..1fffff6 --- /dev/null +++ b/spec/acceptance/nodesets/centos-66-x64.yml @@ -0,0 +1,12 @@ +HOSTS: + centos-66-x64: + roles: + - master + platform: el-6-x86_64 + box: puppetlabs/centos-6.6-64-nocm + box_url: https://vagrantcloud.com/puppetlabs/boxes/centos-6.6-64-nocm + hypervisor: vagrant +CONFIG: + log_level: verbose + type: foss + color: false diff --git a/spec/acceptance/nodesets/centos-70-x64.yml b/spec/acceptance/nodesets/centos-70-x64.yml new file mode 100644 index 0000000..845e47e --- /dev/null +++ b/spec/acceptance/nodesets/centos-70-x64.yml @@ -0,0 +1,12 @@ +HOSTS: + centos-70-x64: + roles: + - master + platform: el-7-x86_64 + box: puppetlabs/centos-7.0-64-nocm + box_url: https://vagrantcloud.com/puppetlabs/boxes/centos-7.0-64-nocm + hypervisor : vagrant +CONFIG: + log_level: verbose + type: foss + color: false diff --git a/spec/acceptance/nodesets/debian-78-x64.yml b/spec/acceptance/nodesets/debian-78-x64.yml new file mode 100644 index 0000000..c4062fd --- /dev/null +++ b/spec/acceptance/nodesets/debian-78-x64.yml @@ -0,0 +1,12 @@ +HOSTS: + debian-78-x64: + roles: + - master + platform: debian-7-amd64 + box: puppetlabs/debian-7.8-64-nocm + box_url: https://vagrantcloud.com/puppetlabs/boxes/debian-7.8-64-nocm + hypervisor: vagrant + +CONFIG: + log_level: verbose + type: foss diff --git a/spec/acceptance/nodesets/ubuntu-server-1204-x86.yml b/spec/acceptance/nodesets/ubuntu-server-1204-x86.yml new file mode 100644 index 0000000..c2e8657 --- /dev/null +++ b/spec/acceptance/nodesets/ubuntu-server-1204-x86.yml @@ -0,0 +1,13 @@ +HOSTS: + ubuntu-server-1204-x64: + roles: + - master + platform: ubuntu-1204-amd64 + box: puppetlabs/ubuntu-12.04-64-nocm + box_url: https://vagrantcloud.com/puppetlabs/boxes/ubuntu-12.04-64-nocm + hypervisor: vagrant + +CONFIG: + log_level: verbose + type: foss + color: false diff --git a/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml b/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml new file mode 100644 index 0000000..2fcee43 --- /dev/null +++ b/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml @@ -0,0 +1,13 @@ +HOSTS: + ubuntu-server-1404-x64: + roles: + - master + platform: ubuntu-server-14.04-amd64 + box: puppetlabs/ubuntu-14.04-64-nocm + box_url: https://vagrantcloud.com/puppetlabs/ubuntu-14.04-64-nocm + hypervisor: vagrant + +CONFIG: + log_level: verbose + type: foss + color: false diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb new file mode 100644 index 0000000..74187d8 --- /dev/null +++ b/spec/spec_helper_acceptance.rb @@ -0,0 +1,29 @@ +require 'beaker-rspec/spec_helper' +require 'beaker-rspec/helpers/serverspec' +require 'pry' + +unless ENV['BEAKER_provision'] == 'no' + hosts.each do |host| + # Install Puppet + if host.is_pe? + install_pe + else + install_puppet + end + end +end + +RSpec.configure do |c| + # Project root + proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..')) + + # Readable test descriptions + c.formatter = :documentation + + # Configure all nodes in nodeset + c.before :suite do + # Install module and dependencies + puppet_module_install(:source => proj_root, :module_name => 'samba') + end +end + -- cgit v1.2.3