Skip to content

Commit

Permalink
replication redo under way
Browse files Browse the repository at this point in the history
  • Loading branch information
pgte committed Jan 21, 2011
1 parent c9fb8b6 commit 43496fa
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 12 deletions.
15 changes: 12 additions & 3 deletions test/replication/test_master_temp_roll.js
Expand Up @@ -9,9 +9,18 @@ var assert = require('assert')
var DB_PATH = __dirname + '/../../tmp/db';

module.exports.setup = function(next) {
fs.readdirSync(DB_PATH).forEach(function(dir) {
fs.unlinkSync(DB_PATH + '/' + dir);
});
(function removeFilesUnder(dir) {
fs.readdirSync(dir).forEach(function(path) {
var path = dir + '/' + path;
var stat = fs.statSync(path);
if (stat.isFile()) {
fs.unlinkSync(path);
} else {
removeFilesUnder(path);
fs.rmdirSync(path);
}
});
})(DB_PATH);
next();
};

Expand Down
20 changes: 14 additions & 6 deletions test/replication/test_slave.js
Expand Up @@ -20,12 +20,20 @@ var USERS = {
var USER_COUNT = 7;

module.exports.setup = function(next) {
fs.readdirSync(MASTER_DB_PATH).forEach(function(dir) {
fs.unlinkSync(MASTER_DB_PATH + '/' + dir);
});
fs.readdirSync(SLAVE_DB_PATH).forEach(function(dir) {
fs.unlinkSync(SLAVE_DB_PATH + '/' + dir);
});
function removeFilesUnder(dir) {
fs.readdirSync(dir).forEach(function(path) {
var path = dir + '/' + path;
var stat = fs.statSync(path);
if (stat.isFile()) {
fs.unlinkSync(path);
} else {
removeFilesUnder(path);
fs.rmdirSync(path);
}
});
};
removeFilesUnder(MASTER_DB_PATH);
removeFilesUnder(SLAVE_DB_PATH);
next();
};

Expand Down
15 changes: 12 additions & 3 deletions test/replication/test_slave_reconnect.js
Expand Up @@ -8,9 +8,18 @@ var assert = require('assert')
var SLAVE_DB_PATH = __dirname + '/../../tmp/db2';

module.exports.setup = function(next) {
fs.readdirSync(SLAVE_DB_PATH).forEach(function(dir) {
fs.unlinkSync(SLAVE_DB_PATH + '/' + dir);
});
(function removeFilesUnder(dir) {
fs.readdirSync(dir).forEach(function(path) {
var path = dir + '/' + path;
var stat = fs.statSync(path);
if (stat.isFile()) {
fs.unlinkSync(path);
} else {
removeFilesUnder(path);
fs.rmdirSync(path);
}
});
})(SLAVE_DB_PATH);
next();
};

Expand Down

0 comments on commit 43496fa

Please sign in to comment.