summaryrefslogtreecommitdiff
path: root/jstests/repl/repl7.js
diff options
context:
space:
mode:
authorAaron <aaron@10gen.com>2009-03-31 14:05:20 -0400
committerAaron <aaron@10gen.com>2009-03-31 14:05:20 -0400
commitcec6d1af97b81d906b31edefda8a2c16b4bb32d7 (patch)
treeee61b6fc9483214c43ca7b5b0e0c3f38098c9450 /jstests/repl/repl7.js
parentc54883ff61ef2726b6e7a11cf1f52851828c3675 (diff)
downloadmongo-cec6d1af97b81d906b31edefda8a2c16b4bb32d7.tar.gz
Persist dbs to add
Diffstat (limited to 'jstests/repl/repl7.js')
-rw-r--r--jstests/repl/repl7.js40
1 files changed, 40 insertions, 0 deletions
diff --git a/jstests/repl/repl7.js b/jstests/repl/repl7.js
new file mode 100644
index 00000000000..6d253f6900e
--- /dev/null
+++ b/jstests/repl/repl7.js
@@ -0,0 +1,40 @@
+// Test persistence of list of dbs to add.
+
+var baseName = "jstests_repl7test";
+
+doTest = function( signal ) {
+
+ // spec small oplog for fast startup on 64bit machines
+ m = startMongod( "--port", "27018", "--dbpath", "/data/db/" + baseName + "-master", "--master", "--oplogSize", "1" );
+
+ for( n = "a"; n != "aaaaa"; n += "a" ) {
+ m.getDB( n ).a.save( {x:1} );
+ }
+
+ s = startMongod( "--port", "27019", "--dbpath", "/data/db/" + baseName + "-slave", "--slave", "--source", "127.0.0.1:27018" );
+
+ assert.soon( function() {
+ return -1 != s.getDBNames().indexOf( "aa" );
+ } );
+
+ stopMongod( 27019, signal );
+ s = startMongoProgram( "mongod", "--port", "27019", "--dbpath", "/data/db/" + baseName + "-slave", "--slave", "--source", "127.0.0.1:27018" );
+
+ assert.soon( function() {
+ for( n = "a"; n != "aaaaa"; n += "a" ) {
+ if ( -1 == s.getDBNames().indexOf( n ) )
+ return false;
+ }
+ return true;
+ } );
+
+ for( n = "a"; n != "aaaaa"; n += "a" ) {
+ assert.eq( 1, m.getDB( n ).a.find().count() );
+ }
+
+ stopMongod( 27019 );
+ stopMongod( 27018 );
+}
+
+doTest( 15 ); // SIGTERM
+doTest( 9 ); // SIGKILL