diff options
author | Eliot Horowitz <eliot@10gen.com> | 2010-08-04 12:32:44 -0400 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2010-08-04 12:32:44 -0400 |
commit | bed0983cc0a94b219eff1f058119cf6169dc2ee4 (patch) | |
tree | 77f19b0225911251f3c31ea73cca80061e6a7e93 /shell | |
parent | ec84f261d14c70072075757abc33ed646f0e4fc5 (diff) | |
download | mongo-bed0983cc0a94b219eff1f058119cf6169dc2ee4.tar.gz |
clean up data files after sharding/replset tests
Diffstat (limited to 'shell')
-rw-r--r-- | shell/servers.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/shell/servers.js b/shell/servers.js index 6a3b7bed569..f952d6510b9 100644 --- a/shell/servers.js +++ b/shell/servers.js @@ -157,6 +157,9 @@ ShardingTest = function( testName , numShards , verboseLevel , numMongos , other var localhost = "localhost"; + this._alldbpaths = [] + + if ( otherParams.rs ){ localhost = getHostName(); // start replica sets @@ -173,6 +176,7 @@ ShardingTest = function( testName , numShards , verboseLevel , numMongos , other this._configServers = [] for ( var i=0; i<3; i++ ){ var conn = startMongodTest( 30000 + i , testName + "-config" + i ); + this._alldbpaths.push( testName + "-config" + i ) this._configServers.push( conn ); } @@ -183,6 +187,7 @@ ShardingTest = function( testName , numShards , verboseLevel , numMongos , other else { for ( var i=0; i<numShards; i++){ var conn = startMongodTest( 30000 + i , testName + i ); + this._alldbpaths.push( testName +i ) this._connections.push( conn ); } @@ -316,6 +321,11 @@ ShardingTest.prototype.stop = function(){ this._rs[i].test.stopSet( 15 ); } } + if ( this._alldbpaths ){ + for( i=0; i<this._alldbpaths.length; i++ ){ + resetDbpath( "/data/db/" + this._alldbpaths[i] ); + } + } print('*** ' + this._testName + " completed successfully ***"); } @@ -1024,6 +1034,10 @@ ReplSetTest.prototype.getPort = function( n ){ ReplSetTest.prototype.getPath = function( n ){ var p = "/data/db/" + this.name + "-"; p += n.toString(); + if ( ! this._alldbpaths ) + this._alldbpaths = [ p ]; + else + this._alldbpaths.push( p ); return p; } @@ -1330,5 +1344,11 @@ ReplSetTest.prototype.stopSet = function( signal ) { for(i=0; i < this.ports.length; i++) { this.stop( i, signal ); } + if ( this._alldbpaths ){ + for( i=0; i<this._alldbpaths.length; i++ ){ + resetDbpath( this._alldbpaths[i] ); + } + } + print('*** Shut down repl set - test worked ****' ) } |