Added modules
This commit is contained in:
parent
c53c931217
commit
59ec520742
646 changed files with 35182 additions and 0 deletions
36
modules/postgresql/spec/unit/classes/client_spec.rb
Normal file
36
modules/postgresql/spec/unit/classes/client_spec.rb
Normal file
|
@ -0,0 +1,36 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'postgresql::client', :type => :class do
|
||||
let :facts do
|
||||
{
|
||||
:osfamily => 'Debian',
|
||||
:operatingsystem => 'Debian',
|
||||
:operatingsystemrelease => '6.0',
|
||||
}
|
||||
end
|
||||
|
||||
describe 'with parameters' do
|
||||
let :params do
|
||||
{
|
||||
:package_ensure => 'absent',
|
||||
:package_name => 'mypackage',
|
||||
}
|
||||
end
|
||||
|
||||
it 'should modify package' do
|
||||
should contain_package("postgresql-client").with({
|
||||
:ensure => 'absent',
|
||||
:name => 'mypackage',
|
||||
:tag => 'postgresql',
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
describe 'with no parameters' do
|
||||
it 'should create package with postgresql tag' do
|
||||
should contain_package('postgresql-client').with({
|
||||
:tag => 'postgresql',
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
29
modules/postgresql/spec/unit/classes/globals_spec.rb
Normal file
29
modules/postgresql/spec/unit/classes/globals_spec.rb
Normal file
|
@ -0,0 +1,29 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'postgresql::globals', :type => :class do
|
||||
let :facts do
|
||||
{
|
||||
:osfamily => 'Debian',
|
||||
:operatingsystem => 'Debian',
|
||||
:operatingsystemrelease => '6.0',
|
||||
:lsbdistid => 'Debian',
|
||||
}
|
||||
end
|
||||
|
||||
describe 'with no parameters' do
|
||||
it 'should work' do
|
||||
should contain_class("postgresql::globals")
|
||||
end
|
||||
end
|
||||
|
||||
describe 'manage_package_repo => true' do
|
||||
let(:params) do
|
||||
{
|
||||
:manage_package_repo => true,
|
||||
}
|
||||
end
|
||||
it 'should pull in class postgresql::repo' do
|
||||
should contain_class("postgresql::repo")
|
||||
end
|
||||
end
|
||||
end
|
12
modules/postgresql/spec/unit/classes/lib/devel_spec.rb
Normal file
12
modules/postgresql/spec/unit/classes/lib/devel_spec.rb
Normal file
|
@ -0,0 +1,12 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'postgresql::lib::devel', :type => :class do
|
||||
let :facts do
|
||||
{
|
||||
:osfamily => 'Debian',
|
||||
:operatingsystem => 'Debian',
|
||||
:operatingsystemrelease => '6.0',
|
||||
}
|
||||
end
|
||||
it { should contain_class("postgresql::lib::devel") }
|
||||
end
|
40
modules/postgresql/spec/unit/classes/lib/java_spec.rb
Normal file
40
modules/postgresql/spec/unit/classes/lib/java_spec.rb
Normal file
|
@ -0,0 +1,40 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'postgresql::lib::java', :type => :class do
|
||||
|
||||
describe 'on a debian based os' do
|
||||
let :facts do {
|
||||
:osfamily => 'Debian',
|
||||
:operatingsystem => 'Debian',
|
||||
:operatingsystemrelease => '6.0',
|
||||
}
|
||||
end
|
||||
it { should contain_package('postgresql-jdbc').with(
|
||||
:name => 'libpostgresql-jdbc-java',
|
||||
:ensure => 'present'
|
||||
)}
|
||||
end
|
||||
|
||||
describe 'on a redhat based os' do
|
||||
let :facts do {
|
||||
:osfamily => 'RedHat',
|
||||
:operatingsystem => 'RedHat',
|
||||
:operatingsystemrelease => '6.4',
|
||||
}
|
||||
end
|
||||
it { should contain_package('postgresql-jdbc').with(
|
||||
:name => 'postgresql-jdbc',
|
||||
:ensure => 'present'
|
||||
)}
|
||||
describe 'when parameters are supplied' do
|
||||
let :params do
|
||||
{:package_ensure => 'latest', :package_name => 'somepackage'}
|
||||
end
|
||||
it { should contain_package('postgresql-jdbc').with(
|
||||
:name => 'somepackage',
|
||||
:ensure => 'latest'
|
||||
)}
|
||||
end
|
||||
end
|
||||
|
||||
end
|
31
modules/postgresql/spec/unit/classes/lib/python_spec.rb
Normal file
31
modules/postgresql/spec/unit/classes/lib/python_spec.rb
Normal file
|
@ -0,0 +1,31 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'postgresql::lib::python', :type => :class do
|
||||
|
||||
describe 'on a redhat based os' do
|
||||
let :facts do {
|
||||
:osfamily => 'RedHat',
|
||||
:operatingsystem => 'RedHat',
|
||||
:operatingsystemrelease => '6.4',
|
||||
}
|
||||
end
|
||||
it { should contain_package('python-psycopg2').with(
|
||||
:name => 'python-psycopg2',
|
||||
:ensure => 'present'
|
||||
)}
|
||||
end
|
||||
|
||||
describe 'on a debian based os' do
|
||||
let :facts do {
|
||||
:osfamily => 'Debian',
|
||||
:operatingsystem => 'Debian',
|
||||
:operatingsystemrelease => '6.0',
|
||||
}
|
||||
end
|
||||
it { should contain_package('python-psycopg2').with(
|
||||
:name => 'python-psycopg2',
|
||||
:ensure => 'present'
|
||||
)}
|
||||
end
|
||||
|
||||
end
|
12
modules/postgresql/spec/unit/classes/params_spec.rb
Normal file
12
modules/postgresql/spec/unit/classes/params_spec.rb
Normal file
|
@ -0,0 +1,12 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'postgresql::params', :type => :class do
|
||||
let :facts do
|
||||
{
|
||||
:osfamily => 'Debian',
|
||||
:operatingsystem => 'Debian',
|
||||
:operatingsystemrelease => '6.0',
|
||||
}
|
||||
end
|
||||
it { should contain_class("postgresql::params") }
|
||||
end
|
18
modules/postgresql/spec/unit/classes/repo_spec.rb
Normal file
18
modules/postgresql/spec/unit/classes/repo_spec.rb
Normal file
|
@ -0,0 +1,18 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'postgresql::repo', :type => :class do
|
||||
let :facts do
|
||||
{
|
||||
:osfamily => 'Debian',
|
||||
:operatingsystem => 'Debian',
|
||||
:operatingsystemrelease => '6.0',
|
||||
:lsbdistid => 'Debian',
|
||||
}
|
||||
end
|
||||
|
||||
describe 'with no parameters' do
|
||||
it 'should instantiate apt_postgresql_org class' do
|
||||
should contain_class('postgresql::repo::apt_postgresql_org')
|
||||
end
|
||||
end
|
||||
end
|
42
modules/postgresql/spec/unit/classes/server/contrib_spec.rb
Normal file
42
modules/postgresql/spec/unit/classes/server/contrib_spec.rb
Normal file
|
@ -0,0 +1,42 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'postgresql::server::contrib', :type => :class do
|
||||
let :pre_condition do
|
||||
"class { 'postgresql::server': }"
|
||||
end
|
||||
|
||||
let :facts do
|
||||
{
|
||||
:osfamily => 'Debian',
|
||||
:operatingsystem => 'Debian',
|
||||
:operatingsystemrelease => '6.0',
|
||||
:kernel => 'Linux',
|
||||
:concat_basedir => tmpfilename('contrib'),
|
||||
}
|
||||
end
|
||||
|
||||
describe 'with parameters' do
|
||||
let(:params) do
|
||||
{
|
||||
:package_name => 'mypackage',
|
||||
:package_ensure => 'absent',
|
||||
}
|
||||
end
|
||||
|
||||
it 'should create package with correct params' do
|
||||
should contain_package('postgresql-contrib').with({
|
||||
:ensure => 'absent',
|
||||
:name => 'mypackage',
|
||||
:tag => 'postgresql',
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
describe 'with no parameters' do
|
||||
it 'should create package with postgresql tag' do
|
||||
should contain_package('postgresql-contrib').with({
|
||||
:tag => 'postgresql',
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
29
modules/postgresql/spec/unit/classes/server/initdb_spec.rb
Normal file
29
modules/postgresql/spec/unit/classes/server/initdb_spec.rb
Normal file
|
@ -0,0 +1,29 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'postgresql::server::initdb', :type => :class do
|
||||
let (:pre_condition) do
|
||||
"include postgresql::server"
|
||||
end
|
||||
describe 'on RedHat' do
|
||||
let :facts do
|
||||
{
|
||||
:osfamily => 'RedHat',
|
||||
:operatingsystem => 'CentOS',
|
||||
:operatingsystemrelease => '6.0',
|
||||
:concat_basedir => tmpfilename('server'),
|
||||
}
|
||||
end
|
||||
it { should contain_file('/var/lib/pgsql/data').with_ensure('directory') }
|
||||
end
|
||||
describe 'on Amazon' do
|
||||
let :facts do
|
||||
{
|
||||
:osfamily => 'RedHat',
|
||||
:operatingsystem => 'Amazon',
|
||||
:concat_basedir => tmpfilename('server'),
|
||||
}
|
||||
end
|
||||
it { should contain_file('/var/lib/pgsql9/data').with_ensure('directory') }
|
||||
end
|
||||
end
|
||||
|
45
modules/postgresql/spec/unit/classes/server/plperl_spec.rb
Normal file
45
modules/postgresql/spec/unit/classes/server/plperl_spec.rb
Normal file
|
@ -0,0 +1,45 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'postgresql::server::plperl', :type => :class do
|
||||
let :facts do
|
||||
{
|
||||
:osfamily => 'Debian',
|
||||
:operatingsystem => 'Debian',
|
||||
:operatingsystemrelease => '6.0',
|
||||
:kernel => 'Linux',
|
||||
:concat_basedir => tmpfilename('plperl'),
|
||||
}
|
||||
end
|
||||
|
||||
let :pre_condition do
|
||||
"class { 'postgresql::server': }"
|
||||
end
|
||||
|
||||
describe 'with no parameters' do
|
||||
it { should contain_class("postgresql::server::plperl") }
|
||||
it 'should create package' do
|
||||
should contain_package('postgresql-plperl').with({
|
||||
:ensure => 'present',
|
||||
:tag => 'postgresql',
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
describe 'with parameters' do
|
||||
let :params do
|
||||
{
|
||||
:package_ensure => 'absent',
|
||||
:package_name => 'mypackage',
|
||||
}
|
||||
end
|
||||
|
||||
it { should contain_class("postgresql::server::plperl") }
|
||||
it 'should create package with correct params' do
|
||||
should contain_package('postgresql-plperl').with({
|
||||
:ensure => 'absent',
|
||||
:name => 'mypackage',
|
||||
:tag => 'postgresql',
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
100
modules/postgresql/spec/unit/classes/server_spec.rb
Normal file
100
modules/postgresql/spec/unit/classes/server_spec.rb
Normal file
|
@ -0,0 +1,100 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'postgresql::server', :type => :class do
|
||||
let :facts do
|
||||
{
|
||||
:osfamily => 'Debian',
|
||||
:operatingsystem => 'Debian',
|
||||
:operatingsystemrelease => '6.0',
|
||||
:concat_basedir => tmpfilename('server'),
|
||||
:kernel => 'Linux',
|
||||
}
|
||||
end
|
||||
|
||||
describe 'with no parameters' do
|
||||
it { should contain_class("postgresql::params") }
|
||||
it { should contain_class("postgresql::server") }
|
||||
it 'should validate connection' do
|
||||
should contain_postgresql__validate_db_connection('validate_service_is_running')
|
||||
end
|
||||
end
|
||||
|
||||
describe 'manage_firewall => true' do
|
||||
let(:params) do
|
||||
{
|
||||
:manage_firewall => true,
|
||||
:ensure => true,
|
||||
}
|
||||
end
|
||||
|
||||
it 'should create firewall rule' do
|
||||
should contain_firewall("5432 accept - postgres")
|
||||
end
|
||||
end
|
||||
|
||||
describe 'ensure => absent' do
|
||||
let(:params) do
|
||||
{
|
||||
:ensure => 'absent',
|
||||
:datadir => '/my/path',
|
||||
:xlogdir => '/xlog/path',
|
||||
}
|
||||
end
|
||||
|
||||
it 'should make package purged' do
|
||||
should contain_package('postgresql-server').with({
|
||||
:ensure => 'purged',
|
||||
})
|
||||
end
|
||||
|
||||
it 'stop the service' do
|
||||
should contain_service('postgresqld').with({
|
||||
:ensure => false,
|
||||
})
|
||||
end
|
||||
|
||||
it 'should remove datadir' do
|
||||
should contain_file('/my/path').with({
|
||||
:ensure => 'absent',
|
||||
})
|
||||
end
|
||||
|
||||
it 'should remove xlogdir' do
|
||||
should contain_file('/xlog/path').with({
|
||||
:ensure => 'absent',
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
describe 'package_ensure => absent' do
|
||||
let(:params) do
|
||||
{
|
||||
:package_ensure => 'absent',
|
||||
}
|
||||
end
|
||||
|
||||
it 'should remove the package' do
|
||||
should contain_package('postgresql-server').with({
|
||||
:ensure => 'purged',
|
||||
})
|
||||
end
|
||||
|
||||
it 'should still enable the service' do
|
||||
should contain_service('postgresqld').with({
|
||||
:ensure => true,
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
describe 'needs_initdb => true' do
|
||||
let(:params) do
|
||||
{
|
||||
:needs_initdb => true,
|
||||
}
|
||||
end
|
||||
|
||||
it 'should contain proper initdb exec' do
|
||||
should contain_exec('postgresql_initdb')
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue