-
Notifications
You must be signed in to change notification settings - Fork 611
Expand file tree
/
Copy pathinitdb_spec.rb
More file actions
120 lines (102 loc) · 3.34 KB
/
Copy pathinitdb_spec.rb
File metadata and controls
120 lines (102 loc) · 3.34 KB
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
112
113
114
115
116
117
118
119
120
# frozen_string_literal: true
require 'spec_helper'
describe 'postgresql::server::initdb' do
let(:pre_condition) do
'include postgresql::server'
end
describe 'on RedHat' do
include_examples 'RedHat 8'
it { is_expected.to contain_file('/var/lib/pgsql/data').with_ensure('directory').with_mode('0700') }
context 'with datadir_mode set to 0750' do
let :pre_condition do
"
class {'postgresql::server':
datadir_mode => '0750',
}
"
end
it { is_expected.to contain_file('/var/lib/pgsql/data').with_ensure('directory').with_mode('0750') }
end
context 'with (log,manage,xlog)_datadir set to false' do
let :pre_condition do
"
class {'postgresql::server':
manage_logdir => false,
manage_datadir => false,
manage_xlogdir => false,
logdir => '/var/lib/pgsql/data/log',
xlogdir => '/var/lib/pgsql/data/xlog',
}
file {'/var/lib/pgsql/data': ensure => 'directory'}
file {'/var/lib/pgsql/data/log': ensure => 'directory'}
file {'/var/lib/pgsql/data/xlog': ensure => 'directory'}
"
end
it { is_expected.to contain_file('/var/lib/pgsql/data').with_ensure('directory') }
it { is_expected.to contain_file('/var/lib/pgsql/data/log').with_ensure('directory') }
it { is_expected.to contain_file('/var/lib/pgsql/data/xlog').with_ensure('directory') }
end
end
describe 'on Amazon' do
include_examples 'Amazon 1'
it { is_expected.to contain_file('/var/lib/pgsql92/data').with_ensure('directory') }
context 'with manage_datadir set to false' do
let :pre_condition do
"
class {'postgresql::server':
manage_datadir => false,
}
file {'/var/lib/pgsql92/data': ensure => 'directory'}
"
end
it { is_expected.to contain_file('/var/lib/pgsql92/data').with_ensure('directory') }
end
end
describe 'exec with module_workdir => /var/tmp' do
include_examples 'RedHat 8'
let(:pre_condition) do
<<-EOS
class { 'postgresql::globals':
module_workdir => '/var/tmp',
}->
class { 'postgresql::server': }
EOS
end
it 'contains exec with specified working directory' do
expect(subject).to contain_exec('postgresql_initdb_instance_main').with(
cwd: '/var/tmp',
)
end
end
describe 'exec with module_workdir => undef' do
include_examples 'RedHat 8'
let(:pre_condition) do
<<-EOS
class { 'postgresql::globals':
}->
class { 'postgresql::server': }
EOS
end
it 'contains exec with default working directory' do
expect(subject).to contain_exec('postgresql_initdb_instance_main').with(
cwd: '/tmp',
)
end
end
describe 'postgresql_psql with module_workdir => /var/tmp' do
include_examples 'RedHat 8'
let(:pre_condition) do
<<-EOS
class { 'postgresql::globals':
module_workdir => '/var/tmp',
encoding => 'test',
needs_initdb => false,
}->
class { 'postgresql::server': }
EOS
end
it 'contains postgresql_psql with specified working directory' do
expect(subject).to contain_postgresql_psql('Set template1 encoding to test').with(cwd: '/var/tmp')
end
end
end