summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron <aaron@10gen.com>2009-05-19 10:55:13 -0400
committerAaron <aaron@10gen.com>2009-05-19 10:55:13 -0400
commit206a330b50fbdce63551681c49c255b3df2e2322 (patch)
tree3c2c6b56cedc2c0317eda0fb9ef725c296b66b1b
parentb039c1f21954405b21a9b4687c9c713a26ed2f02 (diff)
downloadmongo-206a330b50fbdce63551681c49c255b3df2e2322.tar.gz
remove outdated 'mongod <arg>' style tests, add mongod msg test to smokeClient
-rw-r--r--SConstruct6
-rw-r--r--client/dbclient.cpp53
-rw-r--r--db/btree.cpp12
-rw-r--r--db/db.cpp46
-rw-r--r--db/dbhelpers.cpp16
5 files changed, 5 insertions, 128 deletions
diff --git a/SConstruct b/SConstruct
index fa4778bb09f..e2903a67fdd 100644
--- a/SConstruct
+++ b/SConstruct
@@ -788,8 +788,12 @@ def runClientTests( env, target, source ):
global mongodForTestsPort
import subprocess
for i in clientExec:
- if( subprocess.call( [ i, "--port", mongodForTestsPort ] ) != 0 ):
+ if subprocess.call( [ i, "--port", mongodForTestsPort ] ) != 0:
return True
+ if subprocess.Popen( [ mongod[0].abspath, "msg", "ping", mongodForTestsPort ], stdout=subprocess.PIPE ).communicate()[ 0 ].count( "****ok" ) == 0:
+ return True
+ if subprocess.call( [ mongod[0].abspath, "msg", "ping", mongodForTestsPort ] ) != 0:
+ return True
return False
addSmoketest( "smokeClient" , clientExec, runClientTests )
addSmoketest( "mongosTest" , [ mongos[0].abspath ] , [ mongos[0].abspath + " --test" ] )
diff --git a/client/dbclient.cpp b/client/dbclient.cpp
index 4e9246ad6f3..9e0df9d0124 100644
--- a/client/dbclient.cpp
+++ b/client/dbclient.cpp
@@ -341,10 +341,6 @@ namespace mongo {
}
void testPaired();
- int test2() {
- testSort();
- return 0;
- }
/* --- dbclientconnection --- */
@@ -730,55 +726,6 @@ namespace mongo {
}
- /* ------------------------------------------------------ */
-
-// "./db testclient" to invoke
- void testClient3() {
- out() << "testClient()" << endl;
-// DBClientConnection c(true);
- DBClientPaired c;
- string err;
- if ( !c.connect("10.211.55.2", "1.2.3.4") ) {
-// if( !c.connect("10.211.55.2", err) ) {
- out() << "testClient: connect() failed" << endl;
- }
- else {
- // temp:
- out() << "test query returns: " << c.findOne("foo.bar", fromjson("{}")).toString() << endl;
- }
-again:
- out() << "query foo.bar..." << endl;
- auto_ptr<DBClientCursor> cursor =
- c.query("foo.bar", BSONObj(), 0, 0, 0, Option_CursorTailable);
- DBClientCursor *cc = cursor.get();
- if ( cc == 0 ) {
- out() << "query() returned 0, sleeping 10 secs" << endl;
- sleepsecs(10);
- goto again;
- }
- while ( 1 ) {
- bool m;
- try {
- m = cc->more();
- } catch (AssertionException&) {
- out() << "more() asserted, sleeping 10 sec" << endl;
- goto again;
- }
- out() << "more: " << m << " dead:" << cc->isDead() << endl;
- if ( !m ) {
- if ( cc->isDead() )
- out() << "cursor dead, stopping" << endl;
- else {
- out() << "Sleeping 10 seconds" << endl;
- sleepsecs(10);
- continue;
- }
- break;
- }
- out() << cc->next().toString() << endl;
- }
- }
-
/* --- class dbclientpaired --- */
string DBClientPaired::toString() {
diff --git a/db/btree.cpp b/db/btree.cpp
index 7440884aa41..b47712dcda3 100644
--- a/db/btree.cpp
+++ b/db/btree.cpp
@@ -865,16 +865,4 @@ namespace mongo {
b->dumpTree(id.head, order);
}
- void testClient() {
- /* first do:
- test.foo.drop();
- test.foo.ensureIndex({x:9});
- */
- dblock lk;
- DBContext ctxt("test.foo");
- assert( nsdetails("test.foo") );
- assert( nsdetails("test.foo")->nIndexes > 0 );
- BtreeBucket::a_test( nsdetails("test.foo")->indexes[0] );
- }
-
}
diff --git a/db/db.cpp b/db/db.cpp
index 3256616e044..3d51a465993 100644
--- a/db/db.cpp
+++ b/db/db.cpp
@@ -72,16 +72,6 @@ namespace mongo {
}
} mystartupdbcpp;
- void quicktest() {
- out() << "quicktest()\n";
-
- MemoryMappedFile mmf;
- int len = 16384;
- char *m = (char *) mmf.map("/tmp/quicktest", len);
- // out() << "mmf reads: " << m << endl;
- strcpy_s(m, 1000, "hello worldz");
- }
-
QueryResult* emptyMoreResult(long long);
void testTheDb() {
@@ -408,9 +398,6 @@ namespace mongo {
}
}
- int test2();
- void testClient();
-
} // namespace mongo
@@ -441,13 +428,6 @@ int main(int argc, char* argv[], char *envp[] )
UnitTest::runTests();
if ( argc >= 2 ) {
- if ( strcmp(argv[1], "quicktest") == 0 ) {
- quicktest();
- return 0;
- }
- if ( strcmp(argv[1], "test2") == 0 ) {
- return test2();
- }
if ( strcmp(argv[1], "msg") == 0 ) {
// msg(argc >= 3 ? argv[2] : "ping");
@@ -467,31 +447,10 @@ int main(int argc, char* argv[], char *envp[] )
return 0;
}
- if ( strcmp(argv[1], "msglots") == 0 ) {
- msg(argc >= 3 ? argv[2] : "ping", 1000);
- return 0;
- }
- if ( strcmp( argv[1], "testclient") == 0 ) {
- testClient();
- return 0;
- }
- if ( strcmp(argv[1], "zzz") == 0 ) {
- msg(argc >= 3 ? argv[2] : "ping", 1000);
- return 0;
- }
if ( strcmp(argv[1], "run") == 0 ) {
initAndListen(port);
return 0;
}
- if ( strcmp(argv[1], "longmsg") == 0 ) {
- char buf[800000];
- memset(buf, 'a', 799999);
- buf[799999] = 0;
- buf[799998] = 'b';
- buf[0] = 'c';
- msg(buf);
- return 0;
- }
/*
* *** POST STANDARD SWITCH METHOD - if we don't satisfy, we switch to a
@@ -602,11 +561,6 @@ usage:
out() << "Mongo db ";
out() << "usage:\n";
out() << " run run db" << endl;
- out() << " msg [msg] [port] send a request to the db server listening on port (or default)" << endl;
- out() << " msglots send many test messages, and then wait for answer on the last one" << endl;
- out() << " longmsg send a long test message to the db server" << endl;
- out() << " quicktest just check basic assertions and exit" << endl;
- out() << " test2 run test2() - see code" << endl;
out() << "\nOptions:\n";
out() << " --help show this usage information\n";
out() << " --port <portno> specify port number, default is 27017\n";
diff --git a/db/dbhelpers.cpp b/db/dbhelpers.cpp
index 3941dd591c9..e09862483c4 100644
--- a/db/dbhelpers.cpp
+++ b/db/dbhelpers.cpp
@@ -100,22 +100,6 @@ namespace mongo {
return true;
}
- int test2_dbh() {
- dblock lk;
- DBContext c("dwight.foo");
- BSONObj q = fromjson("{\"x\":9}");
- BSONObj result;
-
- {
- BSONObj kp = fromjson("{\"x\":1}");
- Helpers::ensureIndex("dwight.foo", kp, false, "x_1");
- }
-
- cout << Helpers::findOne("dwight.foo", q, result, true) << endl;
- cout << result.toString() << endl;
- return 0;
- }
-
/* Get the first object from a collection. Generally only useful if the collection
only ever has a single object -- which is a "singleton collection.