diff options
author | varac <varacanero@zeromail.org> | 2016-09-06 13:59:05 +0200 |
---|---|---|
committer | varac <varacanero@zeromail.org> | 2016-09-06 13:59:05 +0200 |
commit | 5fbd43d5a948ac7773955a26c1d0cb0db42252d9 (patch) | |
tree | d1f9b2d6b2ad015fec1f53256887b39838748d5f /files/puppet/modules/pixelated/spec | |
parent | cb6740619fe003b4a1956a413844a1a2bfa4b9de (diff) |
git subrepo clone https://github.com/pixelated/puppet-pixelated.git files/puppet/modules/pixelated
subrepo:
subdir: "files/puppet/modules/pixelated"
merged: "6086b94"
upstream:
origin: "https://github.com/pixelated/puppet-pixelated.git"
branch: "master"
commit: "6086b94"
git-subrepo:
version: "0.3.0"
origin: "https://github.com/ingydotnet/git-subrepo.git"
commit: "1e79595"
Diffstat (limited to 'files/puppet/modules/pixelated/spec')
12 files changed, 253 insertions, 0 deletions
diff --git a/files/puppet/modules/pixelated/spec/classes/agent_spec.rb b/files/puppet/modules/pixelated/spec/classes/agent_spec.rb new file mode 100644 index 0000000..f55be37 --- /dev/null +++ b/files/puppet/modules/pixelated/spec/classes/agent_spec.rb @@ -0,0 +1,48 @@ +require 'spec_helper' + describe 'pixelated::agent' do + after :each do + Facter.clear + Facter.clear_messages + end + + + + context 'single node' do + let(:facts) do + { + :operatingsystem => 'Debian', + :osfamily => 'Debian', + :lsbdistid => 'Debian', + :lsbdistcodename => 'jessie', + :testscenario => 'single_node', + } + end + let!(:ensure_packages) { MockFunction.new('ensure_packages',{:type => :statement}) } + let(:pre_condition) { [ + "class stdlib {}", + "define rsyslog::snippet($content) {}", + "define shorewall::rule($source,$destination,$action,$order) {}", + "define apache::vhost::file($content,$mod_security) {}", + "define apt::sources_list($content='deb url') {}", + "define apt::apt_conf($source='file url',$refresh_apt='true') {}", + "define apt::preferences_snippet($release='stable',$priority='999',$pin='release o=Debian') {}", + ] } + + it { should contain_class('pixelated::syslog') } + it { should contain_class('pixelated::tests') } + + it { should contain_service('pixelated-server')} + + # testing if shorewall::masq generates the files + it { should contain_shorewall__rule('net2fw-pixelated-user-agent').with_source('net') } + + it { should contain_apache__vhost__file('pixelated').with_content(/mail.example.com/)} + + it "should configure leap webapp" do + should contain_file('/srv/leap/webapp/config/customization/locales/en.yml').with( 'require' => 'File[/srv/leap/webapp/config/customization/views/common]',) + should contain_file('/srv/leap/webapp/config/customization/views/common/_download_button.html.haml') + should contain_file('/srv/leap/webapp/config/customization/views/users/show.html.haml').with_content(/mail.example.com/) + end + end + +end diff --git a/files/puppet/modules/pixelated/spec/classes/apt_preferences_spec.rb b/files/puppet/modules/pixelated/spec/classes/apt_preferences_spec.rb new file mode 100644 index 0000000..778e739 --- /dev/null +++ b/files/puppet/modules/pixelated/spec/classes/apt_preferences_spec.rb @@ -0,0 +1,26 @@ +require 'spec_helper' + +describe 'pixelated::apt::preferences' do + let(:facts) do + { + :operatingsystem => 'Debian', + :lsbdistid => 'Debian', + :lsbdistcodename => 'jessie', + } + end + + let(:pre_condition) { [ + "class apt {}", + "define apt::sources_list($content='deb url') {}", + "define apt::preferences_snippet($release='stable',$priority='999',$pin='release o=Debian') {}", + ] } + +# %w( soledad-server soledad-client soledad-common leap-keymanager leap-auth).each do | package | + #it { should contain_apt__preferences_snippet("#{package}").with_pin('release o=pixelated')} + #end + + # %w( python-urllib3 python-requests python-six).each do | package | + #it { should contain_apt__preferences_snippet("#{package}").with_release(/jessie/) } + #end + +end diff --git a/files/puppet/modules/pixelated/spec/classes/apt_spec.rb b/files/puppet/modules/pixelated/spec/classes/apt_spec.rb new file mode 100644 index 0000000..df5c33f --- /dev/null +++ b/files/puppet/modules/pixelated/spec/classes/apt_spec.rb @@ -0,0 +1,21 @@ +require 'spec_helper' + +describe 'pixelated::apt' do + let(:facts) do + { + :operatingsystem => 'Debian', + :lsbdistid => 'Debian', + :lsbdistcodename => 'jessie', + } + end + + let(:pre_condition) { [ + "class apt {}", + "define apt::sources_list($content='deb url') {}", + ] } + + it { should contain_apt__sources_list('pixelated.list') } + it { should contain_file('/srv/leap/0x287A1542472DC0E3_packages@pixelated-project.org.asc') } + it { should contain_exec('add_pixelated_key') } + +end diff --git a/files/puppet/modules/pixelated/spec/classes/pixelated_spec.rb b/files/puppet/modules/pixelated/spec/classes/pixelated_spec.rb new file mode 100644 index 0000000..b24f721 --- /dev/null +++ b/files/puppet/modules/pixelated/spec/classes/pixelated_spec.rb @@ -0,0 +1,30 @@ +require 'spec_helper' + +describe 'pixelated' do + context 'single node' do + let(:facts) do + { + :operatingsystem => 'Debian', + :osfamily => 'Debian', + :lsbdistid => 'Debian', + :lsbdistcodename => 'jessie', + :testscenario => 'single_node', + } + end + + let!(:ensure_packages) { MockFunction.new('ensure_packages',{:type => :statement}) } + let(:pre_condition) { [ + "class stdlib {}", + "class apt {}", + "define rsyslog::snippet($content) {}", + "define shorewall::rule($source,$destination,$action,$order) {}", + "define apache::vhost::file($content,$mod_security) {}", + "define apt::sources_list($content='deb url') {}", + "define apt::apt_conf($source='file url',$refresh_apt='true') {}", + "define apt::preferences_snippet($release='stable',$priority='999',$pin='release o=Debian') {}", + ] } + + it { should contain_class('pixelated::agent') } + end +end + diff --git a/files/puppet/modules/pixelated/spec/classes/remove_spec.rb b/files/puppet/modules/pixelated/spec/classes/remove_spec.rb new file mode 100644 index 0000000..5e5567d --- /dev/null +++ b/files/puppet/modules/pixelated/spec/classes/remove_spec.rb @@ -0,0 +1,6 @@ +require 'spec_helper' + +describe 'pixelated::remove' do + it { should compile } +end + diff --git a/files/puppet/modules/pixelated/spec/classes/syslog_spec.rb b/files/puppet/modules/pixelated/spec/classes/syslog_spec.rb new file mode 100644 index 0000000..f1b98a4 --- /dev/null +++ b/files/puppet/modules/pixelated/spec/classes/syslog_spec.rb @@ -0,0 +1,24 @@ +require 'spec_helper' + +describe 'pixelated::syslog' do + let(:facts) do + { + :operatingsystem => 'Debian', + :osfamily => 'Debian', + :lsbdistcodename => 'jessie', + } + end + let(:pre_condition) { [ + "class stdlib {}", + "define rsyslog::snippet($content) {}", + "define shorewall::rule($source,$destination,$action,$order) {}", + "define apache::vhost::file($content,$mod_security) {}", + "define apt::sources_list($content='deb url') {}", + "define apt::apt_conf($source='file url') {}", + "define apt::preferences_snippet($release='stable',$priority='999',$pin='release o=Debian') {}", + ] } + + + it { should contain_rsyslog__snippet('05-pixelated')} + it { should contain_file('/etc/logrotate.d/pixelated')} +end diff --git a/files/puppet/modules/pixelated/spec/classes/tests_spec.rb b/files/puppet/modules/pixelated/spec/classes/tests_spec.rb new file mode 100644 index 0000000..eaf347c --- /dev/null +++ b/files/puppet/modules/pixelated/spec/classes/tests_spec.rb @@ -0,0 +1,50 @@ +require 'spec_helper' + +describe 'pixelated::tests' do + context 'single node' do + let(:facts) do + { + :operatingsystem => 'Debian', + :osfamily => 'Debian', + :lsbdistid => 'Debian', + :lsbdistcodename => 'jessie', + :testscenario => 'single_node', + } + end + + let!(:ensure_packages) { MockFunction.new('ensure_packages',{:type => :statement}) } + let(:pre_condition) { [ + "class stdlib {}", + ] } + + + it do + should contain_file('/srv/leap/tests_custom').with( + 'ensure' => 'directory', + 'mode' => '0755', + ) + end + it do + should contain_file('/srv/leap/tests_custom/functional-tests').with( + 'ensure' => 'directory', + 'recurse' => 'true', + ) + end + + + + it { should contain_file('/srv/leap/tests_custom/pixelated.rb')} + it { should contain_file('/usr/local/bin/phantomjs')} + + it do + should contain_exec('dummy_register_job').with( + "require" => "Class[::Check_mk::Agent::Install]" + ) + end + it do + should contain_cron('run_functional_tests').with( + "command" => """(date; INVITE_CODE_ENABLED=true /usr/bin/mk-job pixelated-functional-tests /usr/local/bin/behave --tags @staging --tags ~@wip --no-capture -k /srv/leap/tests_custom/functional-tests/) >> /var/log/check_mk_jobs.log 2>&1" + ) + end + end +end diff --git a/files/puppet/modules/pixelated/spec/fixtures/hiera/hiera.yaml b/files/puppet/modules/pixelated/spec/fixtures/hiera/hiera.yaml new file mode 100644 index 0000000..2d001ec --- /dev/null +++ b/files/puppet/modules/pixelated/spec/fixtures/hiera/hiera.yaml @@ -0,0 +1,7 @@ +--- +:backends: + - yaml +:hierarchy: + - "%{::testscenario}" +:yaml: + :datadir: 'spec/fixtures/hiera' diff --git a/files/puppet/modules/pixelated/spec/fixtures/hiera/multi_node.yaml b/files/puppet/modules/pixelated/spec/fixtures/hiera/multi_node.yaml new file mode 100644 index 0000000..c8bf5c7 --- /dev/null +++ b/files/puppet/modules/pixelated/spec/fixtures/hiera/multi_node.yaml @@ -0,0 +1,9 @@ +--- +domain: + full: pixelated.example.com + full_suffix: example.com + internal: pixelated.example.i + internal_suffix: example.i + name: pixelated.example.com +services: ["pixelated"] + diff --git a/files/puppet/modules/pixelated/spec/fixtures/hiera/single_node.yaml b/files/puppet/modules/pixelated/spec/fixtures/hiera/single_node.yaml new file mode 100644 index 0000000..0759bdf --- /dev/null +++ b/files/puppet/modules/pixelated/spec/fixtures/hiera/single_node.yaml @@ -0,0 +1,11 @@ +--- +domain: + full: pixelated.example.com + full_suffix: example.com + internal: pixelated.example.i + internal_suffix: example.i + name: pixelated.example.com +services: ["mx","pixelated"] + +webapp: + invite_required: true diff --git a/files/puppet/modules/pixelated/spec/fixtures/hiera/with_nagios.yaml b/files/puppet/modules/pixelated/spec/fixtures/hiera/with_nagios.yaml new file mode 100644 index 0000000..74b9031 --- /dev/null +++ b/files/puppet/modules/pixelated/spec/fixtures/hiera/with_nagios.yaml @@ -0,0 +1,9 @@ +--- +domain: + full: pixelated.example.com + full_suffix: example.com + internal: pixelated.example.i + internal_suffix: example.i + name: pixelated.example.com +services: ["pixelated","monitor"] + diff --git a/files/puppet/modules/pixelated/spec/spec_helper.rb b/files/puppet/modules/pixelated/spec/spec_helper.rb new file mode 100644 index 0000000..fb6ab97 --- /dev/null +++ b/files/puppet/modules/pixelated/spec/spec_helper.rb @@ -0,0 +1,12 @@ +require 'rspec-puppet' +require 'rspec-puppet-utils' +require 'puppetlabs_spec_helper/module_spec_helper' +require 'puppetlabs_spec_helper/puppetlabs_spec_helper' + +fixture_path = File.expand_path(File.join(__FILE__, '..', 'fixtures')) + +RSpec.configure do |c| + c.module_path = File.join(fixture_path, 'modules') + c.manifest_dir = File.join(fixture_path, 'manifests') + c.hiera_config = 'spec/fixtures/hiera/hiera.yaml' +end |