summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorJeoffrey Bauvin <jeoffrey.bauvin.ext@boursorama.fr>2015-10-26 11:52:35 +0100
committerJeoffrey Bauvin <jeoffrey.bauvin.ext@boursorama.fr>2015-10-26 11:52:35 +0100
commit9e34914cc75d5c8199538abcae59a486a2282eb3 (patch)
tree862e2ad188985ab31cfbfc17ec0f6d2f2a732e00 /spec
parente1146e11669136fb06e53112a8db9d674130a6f9 (diff)
Add skeleton
Diffstat (limited to 'spec')
-rw-r--r--spec/acceptance/class_spec.rb26
-rw-r--r--spec/acceptance/nodesets/centos-64-x64.yml11
-rw-r--r--spec/acceptance/nodesets/default.yml12
-rw-r--r--spec/acceptance/nodesets/ubuntu-server-12042-x64.yml12
-rw-r--r--spec/classes/coverage_spec.rb1
-rw-r--r--spec/classes/example_spec.rb35
-rw-r--r--spec/spec_helper.rb1
-rw-r--r--spec/spec_helper_acceptance.rb24
8 files changed, 122 insertions, 0 deletions
diff --git a/spec/acceptance/class_spec.rb b/spec/acceptance/class_spec.rb
new file mode 100644
index 0000000..67434c2
--- /dev/null
+++ b/spec/acceptance/class_spec.rb
@@ -0,0 +1,26 @@
+require 'spec_helper_acceptance'
+
+describe 'gitlab_ci_multi_runner class' do
+
+ context 'default parameters' do
+ # Using puppet_apply as a helper
+ it 'should work with no errors' do
+ pp = <<-EOS
+ class { 'gitlab_ci_multi_runner': }
+ EOS
+
+ # Run it twice and test for idempotency
+ expect(apply_manifest(pp).exit_code).to_not eq(1)
+ expect(apply_manifest(pp).exit_code).to eq(0)
+ end
+
+ describe package('gitlab_ci_multi_runner') do
+ it { should be_installed }
+ end
+
+ describe service('gitlab_ci_multi_runner') do
+ it { should be_enabled }
+ it { should be_running }
+ end
+ end
+end
diff --git a/spec/acceptance/nodesets/centos-64-x64.yml b/spec/acceptance/nodesets/centos-64-x64.yml
new file mode 100644
index 0000000..d19aa69
--- /dev/null
+++ b/spec/acceptance/nodesets/centos-64-x64.yml
@@ -0,0 +1,11 @@
+HOSTS:
+ centos-64-x64:
+ roles:
+ - master
+ platform: el-6-x86_64
+ box : centos-64-x64-vbox4210-nocm
+ box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-64-x64-vbox4210-nocm.box
+ hypervisor : vagrant
+CONFIG:
+ log_level: verbose
+ type: foss
diff --git a/spec/acceptance/nodesets/default.yml b/spec/acceptance/nodesets/default.yml
new file mode 100644
index 0000000..b392dab
--- /dev/null
+++ b/spec/acceptance/nodesets/default.yml
@@ -0,0 +1,12 @@
+HOSTS:
+ ubuntu-server-12042-x64:
+ roles:
+ - master
+ platform: ubuntu-server-12.04-amd64
+ box: ubuntu-server-12042-x64-vbox4210-nocm
+ box_url: http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-12042-x64-vbox4210-nocm.box
+ hypervisor: vagrant
+
+CONFIG:
+ log_level: verbose
+ type: foss
diff --git a/spec/acceptance/nodesets/ubuntu-server-12042-x64.yml b/spec/acceptance/nodesets/ubuntu-server-12042-x64.yml
new file mode 100644
index 0000000..b392dab
--- /dev/null
+++ b/spec/acceptance/nodesets/ubuntu-server-12042-x64.yml
@@ -0,0 +1,12 @@
+HOSTS:
+ ubuntu-server-12042-x64:
+ roles:
+ - master
+ platform: ubuntu-server-12.04-amd64
+ box: ubuntu-server-12042-x64-vbox4210-nocm
+ box_url: http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-12042-x64-vbox4210-nocm.box
+ hypervisor: vagrant
+
+CONFIG:
+ log_level: verbose
+ type: foss
diff --git a/spec/classes/coverage_spec.rb b/spec/classes/coverage_spec.rb
new file mode 100644
index 0000000..12513b8
--- /dev/null
+++ b/spec/classes/coverage_spec.rb
@@ -0,0 +1 @@
+at_exit { RSpec::Puppet::Coverage.report! }
diff --git a/spec/classes/example_spec.rb b/spec/classes/example_spec.rb
new file mode 100644
index 0000000..7dc8942
--- /dev/null
+++ b/spec/classes/example_spec.rb
@@ -0,0 +1,35 @@
+require 'spec_helper'
+
+describe 'gitlab_ci_multi_runner' do
+ context 'supported operating systems' do
+ ['Debian', 'RedHat'].each do |osfamily|
+ describe "gitlab_ci_multi_runner class without any parameters on #{osfamily}" do
+ let(:params) {{ }}
+ let(:facts) {{
+ :osfamily => osfamily,
+ }}
+
+ it { should compile.with_all_deps }
+
+ it { should contain_class('gitlab_ci_multi_runner::params') }
+ it { should contain_class('gitlab_ci_multi_runner::install').that_comes_before('gitlab_ci_multi_runner::config') }
+ it { should contain_class('gitlab_ci_multi_runner::config') }
+ it { should contain_class('gitlab_ci_multi_runner::service').that_subscribes_to('gitlab_ci_multi_runner::config') }
+
+ it { should contain_service('gitlab_ci_multi_runner') }
+ it { should contain_package('gitlab_ci_multi_runner').with_ensure('present') }
+ end
+ end
+ end
+
+ context 'unsupported operating system' do
+ describe 'gitlab_ci_multi_runner class without any parameters on Solaris/Nexenta' do
+ let(:facts) {{
+ :osfamily => 'Solaris',
+ :operatingsystem => 'Nexenta',
+ }}
+
+ it { expect { should contain_package('gitlab_ci_multi_runner') }.to raise_error(Puppet::Error, /Nexenta not supported/) }
+ end
+ end
+end
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
new file mode 100644
index 0000000..2c6f566
--- /dev/null
+++ b/spec/spec_helper.rb
@@ -0,0 +1 @@
+require 'puppetlabs_spec_helper/module_spec_helper'
diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb
new file mode 100644
index 0000000..014b8d5
--- /dev/null
+++ b/spec/spec_helper_acceptance.rb
@@ -0,0 +1,24 @@
+require 'beaker-rspec/spec_helper'
+require 'beaker-rspec/helpers/serverspec'
+
+hosts.each do |host|
+ # Install Puppet
+ install_puppet
+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 => 'gitlab_ci_multi_runner')
+ hosts.each do |host|
+ on host, puppet('module', 'install', 'puppetlabs-stdlib'), { :acceptable_exit_codes => [0,1] }
+ end
+ end
+end