summaryrefslogtreecommitdiff
path: root/buildscripts
diff options
context:
space:
mode:
authorMike Dirolf <mike@10gen.com>2010-09-01 16:35:51 -0400
committerMike Dirolf <mike@10gen.com>2010-09-01 16:35:51 -0400
commit0920dbf99171829b2c3561931c28ea9147973e32 (patch)
tree6bddf760d74fa93bdd6acf376487b27e091106d4 /buildscripts
parent465566855dd88b84ed7b18c1de0bf9ebd7cfb5b9 (diff)
downloadmongo-0920dbf99171829b2c3561931c28ea9147973e32.tar.gz
Revert "Revert "replace shelling out w/ pymongo calls in smoke.py""
This reverts commit 465566855dd88b84ed7b18c1de0bf9ebd7cfb5b9.
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