/usr/share/puppet/modules.available/puppetlabs-mongodb/spec/system/server_10gen_spec.rb is in puppet-module-puppetlabs-mongodb 0.7.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | require 'spec_helper_system'
describe 'mongodb::server: with 10gen repo' do
case node.facts['osfamily']
when 'RedHat'
package_name = 'mongo-10gen-server'
service_name = 'mongod'
config_file = '/etc/mongod.conf'
when 'Debian'
package_name = 'mongodb-10gen'
service_name = 'mongodb'
config_file = '/etc/mongodb.conf'
end
client_name = 'mongo --version'
context 'default parameters' do
it 'should work with no errors' do
case node.facts['osfamily']
when 'RedHat'
pp = <<-EOS
class { 'mongodb::globals': manage_package_repo => true }->
class { 'mongodb::server': }->
class { 'mongodb::client': }
EOS
when 'Debian'
pp = <<-EOS
class { 'mongodb::globals': manage_package_repo => true }->
class { 'mongodb::server': }
EOS
end
puppet_apply(pp) do |r|
r.exit_code.should == 2
r.refresh
r.exit_code.should == 0
end
end
describe package(package_name) do
it { should be_installed }
end
describe file(config_file) do
it { should be_file }
end
describe service(service_name) do
it { should be_enabled }
it { should be_running }
end
describe port(27017) do
it do
sleep(20)
should be_listening
end
end
describe command(client_name) do
it do
should return_exit_status 0
end
end
end
context 'test using custom port' do
it 'change port to 27018' do
pp = <<-EOS
class { 'mongodb::globals': manage_package_repo => true }->
class { 'mongodb::server': port => 27018 }
EOS
puppet_apply(pp) do |r|
r.exit_code.should == 2
end
end
describe port(27018) do
sleep(20)
it { should be_listening }
end
end
context 'test shutdown of custom port' do
it 'shut down service on port 27018' do
pp = <<-EOS
class {'mongodb::globals': manage_package_repo => true}->
class {'mongodb::server': port => 27018, ensure => false}
EOS
puppet_apply(pp) do |r|
r.exit_code.should == 2
end
end
describe port(27018) do
it { should_not be_listening}
end
end
describe 'cleanup' do
it 'uninstalls mongodb' do
puppet_apply("class {'mongodb::globals': manage_package_repo => true }-> class { 'mongodb::server': ensure => false }-> class { 'mongodb::client': ensure => false}") do |r|
r.exit_code.should_not == 1
end
end
end
end
|