Skip to content

Commit 76dd716

Browse files
author
Henning Block
committed
fix tests
1 parent 544cc40 commit 76dd716

File tree

8 files changed

+26
-4
lines changed

8 files changed

+26
-4
lines changed

spec/classes/mongos_config_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
{
99
:osfamily => 'Debian',
1010
:operatingsystem => 'Debian',
11+
:root_home => '/root'
1112
}
1213
end
1314

spec/classes/mongos_install_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
{
99
:osfamily => 'Debian',
1010
:operatingsystem => 'Debian',
11+
:root_home => '/root'
1112
}
1213
end
1314

spec/classes/mongos_service_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
:osfamily => 'Debian',
99
:operatingsystem => 'Debian',
1010
:operatingsystemrelease => '7.0',
11+
:root_home=> '/root'
1112
}
1213
end
1314

spec/classes/mongos_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
{
66
:osfamily => 'Debian',
77
:operatingsystem => 'Debian',
8+
:root_home=> '/root'
89
}
910
end
1011

spec/classes/repo_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
:operatingsystem => 'Debian',
1010
:operatingsystemrelease => '7.0',
1111
:lsbdistid => 'Debian',
12+
:root_home=> '/root'
1213
}
1314
end
1415

spec/classes/server_config_spec.rb

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
describe 'mongodb::server::config', :type => :class do
44

55
describe 'with preseted variables' do
6+
let(:facts){{:root_home => '/root'}}
67
let(:pre_condition) { ["class mongodb::server { $config = '/etc/mongod.conf' $dbpath = '/var/lib/mongo' $rcfile = '/root/.mongorc.js' }", "include mongodb::server"]}
78

89
it {
@@ -12,6 +13,7 @@
1213
end
1314

1415
describe 'with default values' do
16+
let(:facts){{:root_home => '/root'}}
1517
let(:pre_condition) {[ "class mongodb::server { $config = '/etc/mongod.conf' $dbpath = '/var/lib/mongo' $create_admin = false $rcfile = '/root/.mongorc.js' $store_creds = true $ensure = present $user = 'mongod' $group = 'mongod' $port = 29017 $bind_ip = ['0.0.0.0'] $fork = true $logpath ='/var/log/mongo/mongod.log' $logappend = true }", "include mongodb::server" ]}
1618

1719
it {
@@ -33,6 +35,7 @@
3335
end
3436

3537
describe 'with absent ensure' do
38+
let(:facts){{:root_home => '/root'}}
3639
let(:pre_condition) { ["class mongodb::server { $config = '/etc/mongod.conf' $dbpath = '/var/lib/mongo' $rcfile = '/root/.mongorc.js' $ensure = absent }", "include mongodb::server"]}
3740

3841
it {
@@ -42,6 +45,7 @@
4245
end
4346

4447
describe 'when specifying storage_engine' do
48+
let(:facts){{:root_home => '/root'}}
4549
let(:pre_condition) { ["class mongodb::server { $config = '/etc/mongod.conf' $dbpath = '/var/lib/mongo' $rcfile = '/root/.monogrc.js' $ensure = present $version='3.0.3' $storage_engine = 'SomeEngine' $storage_engine_internal = 'SomeEngine' $user = 'mongod' $group = 'mongod' $port = 29017 $bind_ip = ['0.0.0.0'] $fork = true $logpath ='/var/log/mongo/mongod.log' $logappend = true}", "include mongodb::server"]}
4650

4751
it {
@@ -50,6 +54,7 @@
5054
end
5155

5256
describe 'with specific bind_ip values and ipv6' do
57+
let(:facts){{:root_home => '/root'}}
5358
let(:pre_condition) { ["class mongodb::server { $config = '/etc/mongod.conf' $dbpath = '/var/lib/mongo' $rcfile = '/root/.mongorc.js' $ensure = present $bind_ip = ['127.0.0.1', 'fd00:beef:dead:55::143'] $ipv6 = true }", "include mongodb::server"]}
5459

5560
it {
@@ -59,6 +64,7 @@
5964
end
6065

6166
describe 'with specific bind_ip values' do
67+
let(:facts){{:root_home => '/root'}}
6268
let(:pre_condition) { ["class mongodb::server { $config = '/etc/mongod.conf' $dbpath = '/var/lib/mongo' $rcfile = '/root/.mongorc.js' $ensure = present $bind_ip = ['127.0.0.1', '10.1.1.13']}", "include mongodb::server"]}
6369

6470
it {
@@ -67,6 +73,7 @@
6773
end
6874

6975
describe 'when specifying auth to true' do
76+
let(:facts){{:root_home => '/root'}}
7077
let(:pre_condition) { ["class mongodb::server { $config = '/etc/mongod.conf' $auth = true $dbpath = '/var/lib/mongo' $rcfile = '/root/.mongorc.js' $ensure = present }", "include mongodb::server"]}
7178

7279
it {
@@ -76,6 +83,7 @@
7683
end
7784

7885
describe 'when specifying set_parameter value' do
86+
let(:facts){{:root_home => '/root'}}
7987
let(:pre_condition) { ["class mongodb::server { $config = '/etc/mongod.conf' $set_parameter = 'textSearchEnable=true' $dbpath = '/var/lib/mongo' $rcfile = '/root/.mongorc.js' $ensure = present }", "include mongodb::server"]}
8088

8189
it {
@@ -86,7 +94,7 @@
8694
describe 'with journal:' do
8795
context 'on true with i686 architecture' do
8896
let(:pre_condition) { ["class mongodb::server { $config = '/etc/mongod.conf' $dbpath = '/var/lib/mongo' $rcfile = '/root/.mongorc.js' $ensure = present $journal = true }", "include mongodb::server"]}
89-
let (:facts) { { :architecture => 'i686' } }
97+
let (:facts) { { :architecture => 'i686', :root_home => '/root' } }
9098

9199
it {
92100
is_expected.to contain_file('/etc/mongod.conf').with_content(/^journal = true/)
@@ -98,13 +106,15 @@
98106
describe 'with quota to' do
99107

100108
context 'true and without quotafiles' do
109+
let(:facts){{:root_home => '/root'}}
101110
let(:pre_condition) { ["class mongodb::server { $config = '/etc/mongod.conf' $dbpath = '/var/lib/mongo' $rcfile = '/root/.mongorc.js' $ensure = present $quota = true }", "include mongodb::server"]}
102111
it {
103112
is_expected.to contain_file('/etc/mongod.conf').with_content(/^quota = true/)
104113
}
105114
end
106115

107116
context 'true and with quotafiles' do
117+
let(:facts){{:root_home => '/root'}}
108118
let(:pre_condition) { ["class mongodb::server { $config = '/etc/mongod.conf' $dbpath = '/var/lib/mongo' $rcfile = '/root/.mongorc.js' $ensure = present $quota = true $quotafiles = 1 }", "include mongodb::server"]}
109119

110120
it {
@@ -116,6 +126,7 @@
116126

117127
describe 'when specifying syslog value' do
118128
context 'it should be set to true' do
129+
let(:facts){{:root_home => '/root'}}
119130
let(:pre_condition) { ["class mongodb::server { $config = '/etc/mongod.conf' $dbpath = '/var/lib/mongo' $rcfile = '/root/.mongorc.js' $ensure = present $syslog = true }", "include mongodb::server"]}
120131

121132
it {
@@ -124,6 +135,7 @@
124135
end
125136

126137
context 'if logpath is also set an error should be raised' do
138+
let(:facts){{:root_home => '/root'}}
127139
let(:pre_condition) { ["class mongodb::server { $config = '/etc/mongod.conf' $dbpath = '/var/lib/mongo' $rcfile = '/root/.mongorc.js' $ensure = present $syslog = true $logpath ='/var/log/mongo/mongod.log' }", "include mongodb::server"]}
128140

129141
it {
@@ -134,7 +146,8 @@
134146
end
135147

136148
describe 'with store_creds' do
137-
context 'true' do
149+
context 'true' do
150+
let(:facts){{:root_home => '/root'}}
138151
let(:pre_condition) { ["class mongodb::server { $admin_username = 'admin' $admin_password = 'password' $auth = true $store_creds = true $config = '/etc/mongod.conf' $dbpath = '/var/lib/mongo' $rcfile = '/root/.mongorc.js' $ensure = present }", "include mongodb::server"]}
139152

140153
it {
@@ -148,6 +161,7 @@
148161
end
149162

150163
context 'false' do
164+
let(:facts){{:root_home => '/root'}}
151165
let(:pre_condition) { ["class mongodb::server { $config = '/etc/mongod.conf' $dbpath = '/var/lib/mongo' $rcfile = '/root/.mongorc.js' $ensure = present $store_creds = false }", "include mongodb::server"]}
152166

153167
it {

spec/classes/server_spec.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
{
66
:osfamily => 'Debian',
77
:operatingsystem => 'Debian',
8+
:root_home => '/root'
89
}
910
end
1011

@@ -46,7 +47,9 @@
4647

4748
context 'when deploying on Solaris' do
4849
let :facts do
49-
{ :osfamily => 'Solaris' }
50+
{ :osfamily => 'Solaris',
51+
:root_home => '/root'
52+
}
5053
end
5154
it { expect { is_expected.to raise_error(Puppet::Error) } }
5255
end

spec/unit/puppet/provider/mongodb_replset/mongodb_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
allow(provider).to receive(:alive_members).and_return(valid_members)
5555
allow(provider).to receive(:master_host).and_return(false)
5656
allow(provider).to receive(:rs_arbiter).and_return('mongo3:27017')
57-
expect(provider).to receive('rs_initiate').with("{ _id: \"rs_test\", members: [ { _id: 0, host: \"mongo1:27017\" },{ _id: 1, host: \"mongo2:27017\" },{ _id: 2, host: \"mongo3:27017\", arbiterOnly: \"true\" } ] }", "mongo1:27017").and_return({
57+
expect(provider).to receive('rs_initiate').with("{ _id: \"rs_test\", members: [ { _id: 0, host: \"mongo1:27017\" },{ _id: 1, host: \"mongo2:27017\" },{ _id: 2, host: \"mongo3:27017\", arbiterOnly: true } ] }", "mongo1:27017").and_return({
5858
"info" => "Config now saved locally. Should come online in about a minute.",
5959
"ok" => 1,
6060
})

0 commit comments

Comments
 (0)