summaryrefslogtreecommitdiff
path: root/buildscripts
diff options
context:
space:
mode:
authorMike Dirolf <mike@10gen.com>2010-08-30 15:02:18 -0400
committerMike Dirolf <mike@10gen.com>2010-09-01 10:13:50 -0400
commitc3d1c6d43bc5dd69469d3076bdc7b0f9b6a19790 (patch)
treebc643dbf5c24424d5447e69da285014c4e76ddf2 /buildscripts
parent06825dfc011ef622deb4a2762960e2d68bc7704d (diff)
downloadmongo-c3d1c6d43bc5dd69469d3076bdc7b0f9b6a19790.tar.gz
replace shelling out w/ pymongo calls in smoke.py
Diffstat (limited to 'buildscripts')
-rwxr-xr-xbuildscripts/smoke.py24
1 files changed, 11 insertions, 13 deletions
diff --git a/buildscripts/smoke.py b/buildscripts/smoke.py
index 8233dee186a..99db86aab7f 100755
--- a/buildscripts/smoke.py
+++ b/buildscripts/smoke.py
@@ -49,6 +49,8 @@ from subprocess import (Popen,
import sys
import time
+from pymongo import Connection
+
import utils
# TODO clean this up so we don't need globals...
@@ -159,11 +161,12 @@ class mongod(object):
raise Exception("Failed to start mongod")
if self.slave:
- while True:
- argv = [shell_executable, "--port", str(self.port), "--quiet", "--eval", 'db.printSlaveReplicationInfo()']
- res = Popen(argv, stdout=PIPE).communicate()[0]
- if res.find('initial sync') < 0:
- break
+ local = Connection(port=self.port).local
+ synced = False
+ while not synced:
+ synced = True
+ for source in local.sources.find(fields=["syncedTo"]):
+ synced = synced and "syncedTo" in source and source["syncedTo"]
def stop(self):
if not self.proc:
@@ -211,17 +214,12 @@ def check_db_hashes(master, slave):
if not slave.slave:
raise(Bug("slave instance doesn't have slave attribute set"))
- print "waiting for slave to catch up..."
- argv = [shell_executable, "--port", str(master.port), "--quiet", "--eval", 'db.smokeWait.insert( {} ); printjson( db.getLastErrorCmd(2, 120000) );']
- res = Popen(argv, stdout=PIPE).communicate()
- print "wait result: " + str( res[0] ) + "\t" + str( res[1] )
+ print "waiting for slave to catch up, result:"
+ print Connection(port=master.port).test.smokeWait.insert({}, w=2, wtimeout=120000)
# FIXME: maybe make this run dbhash on all databases?
for mongod in [master, slave]:
- argv = [shell_executable, "--port", str(mongod.port), "--quiet", "--eval", "x=db.runCommand('dbhash'); printjson(x.collections)"]
- hashstr = Popen(argv, stdout=PIPE).communicate()[0]
- # WARNING FIXME KLUDGE et al.: this is sleazy and unsafe.
- mongod.dict = eval(hashstr)
+ mongod.dict = Connection(port=mongod.port).test.command("dbhash")["collections"]
global lost_in_slave, lost_in_master, screwy_in_slave, replicated_dbs