|
3 | 3 | describe 'mongodb::server::config', :type => :class do |
4 | 4 |
|
5 | 5 | describe 'with preseted variables' do |
| 6 | + let(:facts){{:root_home => '/root'}} |
6 | 7 | let(:pre_condition) { ["class mongodb::server { $config = '/etc/mongod.conf' $dbpath = '/var/lib/mongo' $rcfile = '/root/.mongorc.js' }", "include mongodb::server"]} |
7 | 8 |
|
8 | 9 | it { |
|
12 | 13 | end |
13 | 14 |
|
14 | 15 | describe 'with default values' do |
| 16 | + let(:facts){{:root_home => '/root'}} |
15 | 17 | 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" ]} |
16 | 18 |
|
17 | 19 | it { |
|
33 | 35 | end |
34 | 36 |
|
35 | 37 | describe 'with absent ensure' do |
| 38 | + let(:facts){{:root_home => '/root'}} |
36 | 39 | let(:pre_condition) { ["class mongodb::server { $config = '/etc/mongod.conf' $dbpath = '/var/lib/mongo' $rcfile = '/root/.mongorc.js' $ensure = absent }", "include mongodb::server"]} |
37 | 40 |
|
38 | 41 | it { |
|
42 | 45 | end |
43 | 46 |
|
44 | 47 | describe 'when specifying storage_engine' do |
| 48 | + let(:facts){{:root_home => '/root'}} |
45 | 49 | 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"]} |
46 | 50 |
|
47 | 51 | it { |
|
50 | 54 | end |
51 | 55 |
|
52 | 56 | describe 'with specific bind_ip values and ipv6' do |
| 57 | + let(:facts){{:root_home => '/root'}} |
53 | 58 | 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"]} |
54 | 59 |
|
55 | 60 | it { |
|
59 | 64 | end |
60 | 65 |
|
61 | 66 | describe 'with specific bind_ip values' do |
| 67 | + let(:facts){{:root_home => '/root'}} |
62 | 68 | 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"]} |
63 | 69 |
|
64 | 70 | it { |
|
67 | 73 | end |
68 | 74 |
|
69 | 75 | describe 'when specifying auth to true' do |
| 76 | + let(:facts){{:root_home => '/root'}} |
70 | 77 | 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"]} |
71 | 78 |
|
72 | 79 | it { |
|
76 | 83 | end |
77 | 84 |
|
78 | 85 | describe 'when specifying set_parameter value' do |
| 86 | + let(:facts){{:root_home => '/root'}} |
79 | 87 | 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"]} |
80 | 88 |
|
81 | 89 | it { |
|
86 | 94 | describe 'with journal:' do |
87 | 95 | context 'on true with i686 architecture' do |
88 | 96 | 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' } } |
90 | 98 |
|
91 | 99 | it { |
92 | 100 | is_expected.to contain_file('/etc/mongod.conf').with_content(/^journal = true/) |
|
98 | 106 | describe 'with quota to' do |
99 | 107 |
|
100 | 108 | context 'true and without quotafiles' do |
| 109 | + let(:facts){{:root_home => '/root'}} |
101 | 110 | 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"]} |
102 | 111 | it { |
103 | 112 | is_expected.to contain_file('/etc/mongod.conf').with_content(/^quota = true/) |
104 | 113 | } |
105 | 114 | end |
106 | 115 |
|
107 | 116 | context 'true and with quotafiles' do |
| 117 | + let(:facts){{:root_home => '/root'}} |
108 | 118 | 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"]} |
109 | 119 |
|
110 | 120 | it { |
|
116 | 126 |
|
117 | 127 | describe 'when specifying syslog value' do |
118 | 128 | context 'it should be set to true' do |
| 129 | + let(:facts){{:root_home => '/root'}} |
119 | 130 | 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"]} |
120 | 131 |
|
121 | 132 | it { |
|
124 | 135 | end |
125 | 136 |
|
126 | 137 | context 'if logpath is also set an error should be raised' do |
| 138 | + let(:facts){{:root_home => '/root'}} |
127 | 139 | 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"]} |
128 | 140 |
|
129 | 141 | it { |
|
134 | 146 | end |
135 | 147 |
|
136 | 148 | describe 'with store_creds' do |
137 | | - context 'true' do |
| 149 | + context 'true' do |
| 150 | + let(:facts){{:root_home => '/root'}} |
138 | 151 | 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"]} |
139 | 152 |
|
140 | 153 | it { |
|
148 | 161 | end |
149 | 162 |
|
150 | 163 | context 'false' do |
| 164 | + let(:facts){{:root_home => '/root'}} |
151 | 165 | 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"]} |
152 | 166 |
|
153 | 167 | it { |
|
0 commit comments