From 785c3b961d9d9e122a7cd8b5ff35c04338a49957 Mon Sep 17 00:00:00 2001
From: Lloyd Hilaiel <lloyd@hilaiel.com>
Date: Mon, 14 Nov 2011 15:50:01 -0700
Subject: [PATCH] lock down who may write the database for testing purposes. 
 issue #460

---
 lib/configuration.js    | 7 +++++--
 tests/lib/start-stop.js | 1 -
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/lib/configuration.js b/lib/configuration.js
index 5151ffba8..889bc139f 100644
--- a/lib/configuration.js
+++ b/lib/configuration.js
@@ -221,8 +221,11 @@ g_config['process_type'] = path.basename(process.argv[1], ".js");
 
 g_config['public_key'] = secrets.loadPublicKey('root', exports.get('var_path'));
 
-// only allow the dbwriter process to write to the database
-g_config.database.may_write = true; //(g_config.process_type === 'dbwriter');
+// only allow the dbwriter process to write to the database (or the unit tests)
+g_config.database.may_write = (g_config.process_type === 'dbwriter' ||
+                               g_config.process_type === 'vows' ||
+                               g_config.process_type === 'db-test');
+console.log(g_config.process_type, "may write", g_config.database.may_write);
 
 // log the process_type
 setTimeout(function() {
diff --git a/tests/lib/start-stop.js b/tests/lib/start-stop.js
index 8c302ab28..7432041dd 100644
--- a/tests/lib/start-stop.js
+++ b/tests/lib/start-stop.js
@@ -219,4 +219,3 @@ exports.addShutdownBatches = function(suite) {
     }
   });
 }
-
-- 
GitLab