66 describe 'mongodb_replset resource' do
77 after :all do
88 # Have to drop the DB to disable replsets for further testing
9- on hosts , %{mongo local --verbose --eval 'db.dropDatabase()'}
9+ on hosts , %{mongosh local --verbose --eval 'db.dropDatabase()'}
1010
1111 pp = <<-EOS
1212 class { 'mongodb::globals': }
@@ -48,26 +48,26 @@ class { 'mongodb::client': }
4848 }
4949 EOS
5050 apply_manifest_on ( hosts_as ( 'master' ) , pp , catch_failures : true )
51- on ( hosts_as ( 'master' ) , 'mongo --quiet --eval "EJSON.stringify(rs.conf())"' ) do |r |
51+ on ( hosts_as ( 'master' ) , 'mongosh --quiet --eval "EJSON.stringify(rs.conf())"' ) do |r |
5252 expect ( r . stdout ) . to match %r{#{ hosts [ 0 ] } :27017}
5353 expect ( r . stdout ) . to match %r{#{ hosts [ 1 ] } :27017}
5454 end
5555 end
5656
5757 it 'inserts data on the master' do
5858 sleep ( 30 )
59- on hosts_as ( 'master' ) , %{mongo --verbose --eval 'db.test.save({name:"test1",value:"some value"})'}
59+ on hosts_as ( 'master' ) , %{mongosh --verbose --eval 'db.test.save({name:"test1",value:"some value"})'}
6060 end
6161
6262 it 'checks the data on the master' do
63- on hosts_as ( 'master' ) , %{mongo --verbose --eval 'EJSON.stringify(db.test.findOne({name:"test1"}))'} do |r |
63+ on hosts_as ( 'master' ) , %{mongosh --verbose --eval 'EJSON.stringify(db.test.findOne({name:"test1"}))'} do |r |
6464 expect ( r . stdout ) . to match %r{some value}
6565 end
6666 end
6767
6868 it 'checks the data on the slave' do
6969 sleep ( 10 )
70- on hosts_as ( 'slave' ) , %{mongo --verbose --eval 'db.getMongo().setReadPref("primaryPreferred"); EJSON.stringify(db.test.findOne({name:"test1"}))'} do |r |
70+ on hosts_as ( 'slave' ) , %{mongosh --verbose --eval 'db.getMongo().setReadPref("primaryPreferred"); EJSON.stringify(db.test.findOne({name:"test1"}))'} do |r |
7171 expect ( r . stdout ) . to match %r{some value}
7272 end
7373 end
@@ -76,7 +76,7 @@ class { 'mongodb::client': }
7676 describe 'mongodb_replset resource with auth => true' do
7777 after :all do
7878 # Have to drop the DB to disable replsets for further testing
79- on hosts , %{mongo local --verbose --eval 'db.dropDatabase()'}
79+ on hosts , %{mongosh local --verbose --eval 'db.dropDatabase()'}
8080
8181 pp = <<-EOS
8282 class { 'mongodb::globals': }
@@ -177,26 +177,26 @@ class { 'mongodb::server':
177177 EOS
178178 apply_manifest_on ( hosts_as ( 'master' ) , pp , catch_failures : true )
179179 apply_manifest_on ( hosts_as ( 'master' ) , pp , catch_changes : true )
180- on ( hosts_as ( 'master' ) , 'mongo --quiet --eval "load(\'/root/.mongoshrc.js\');EJSON.stringify(rs.conf())"' ) do |r |
180+ on ( hosts_as ( 'master' ) , 'mongosh --quiet --eval "load(\'/root/.mongoshrc.js\');EJSON.stringify(rs.conf())"' ) do |r |
181181 expect ( r . stdout ) . to match %r{#{ hosts [ 0 ] } :27017}
182182 expect ( r . stdout ) . to match %r{#{ hosts [ 1 ] } :27017}
183183 end
184184 end
185185
186186 it 'inserts data on the master' do
187187 sleep ( 30 )
188- on hosts_as ( 'master' ) , %{mongo test --verbose --eval 'load("/root/.mongoshrc.js");db.dummyData.insert({"created_by_puppet": 1})'}
188+ on hosts_as ( 'master' ) , %{mongosh test --verbose --eval 'load("/root/.mongoshrc.js");db.dummyData.insert({"created_by_puppet": 1})'}
189189 end
190190
191191 it 'checks the data on the master' do
192- on hosts_as ( 'master' ) , %{mongo test --verbose --eval 'load("/root/.mongoshrc.js");EJSON.stringify(db.dummyData.findOne())'} do |r |
192+ on hosts_as ( 'master' ) , %{mongosh test --verbose --eval 'load("/root/.mongoshrc.js");EJSON.stringify(db.dummyData.findOne())'} do |r |
193193 expect ( r . stdout ) . to match %r{created_by_puppet}
194194 end
195195 end
196196
197197 it 'checks the data on the slave' do
198198 sleep ( 10 )
199- on hosts_as ( 'slave' ) , %{mongo test --verbose --eval 'load("/root/.mongoshrc.js");db.getMongo().setReadPref("primaryPreferred");EJSON.stringify(db.dummyData.findOne())'} do |r |
199+ on hosts_as ( 'slave' ) , %{mongosh test --verbose --eval 'load("/root/.mongoshrc.js");db.getMongo().setReadPref("primaryPreferred");EJSON.stringify(db.dummyData.findOne())'} do |r |
200200 expect ( r . stdout ) . to match %r{created_by_puppet}
201201 end
202202 end
0 commit comments