summaryrefslogtreecommitdiff
path: root/jstests/sharding/mr_noscripting.js
diff options
context:
space:
mode:
authorRandolph Tan <randolph@10gen.com>2012-11-12 18:01:40 -0500
committerRandolph Tan <randolph@10gen.com>2012-11-12 18:01:40 -0500
commitcf0f0a4d278ce3f2fd0b5015f3cbd0d48d409f65 (patch)
treeb356d900f46085085fe44857a1c15719f5fb0b7d /jstests/sharding/mr_noscripting.js
parent7f9749e7293d1891497d69744d6dedd1f1e81798 (diff)
downloadmongo-cf0f0a4d278ce3f2fd0b5015f3cbd0d48d409f65.tar.gz
SERVER-5384 segfault attemptimg mapreduce with --noscripting
Added test for mongos
Diffstat (limited to 'jstests/sharding/mr_noscripting.js')
-rw-r--r--jstests/sharding/mr_noscripting.js41
1 files changed, 41 insertions, 0 deletions
diff --git a/jstests/sharding/mr_noscripting.js b/jstests/sharding/mr_noscripting.js
new file mode 100644
index 00000000000..a7663d54ccc
--- /dev/null
+++ b/jstests/sharding/mr_noscripting.js
@@ -0,0 +1,41 @@
+var shardOpts = [
+ { noscripting: '' },
+ { } // just use default params
+];
+
+var st = new ShardingTest({ shards: shardOpts, other: { nopreallocj: 1 }});
+var mongos = st.s;
+
+st.shardColl('bar', { x: 1 });
+
+var testDB = mongos.getDB('test');
+var coll = testDB.bar;
+
+coll.insert({ x: 1 });
+
+var map = function() {
+ emit(this.x, 1);
+};
+
+var reduce = function(key, values) {
+ return 1;
+};
+
+var mrResult = testDB.runCommand({ mapreduce: 'bar', map: map, reduce: reduce,
+ out: { inline: 1 }});
+
+assert.eq(0, mrResult.ok, 'mr result: ' + tojson(mrResult));
+
+// Confirm that mongos did not crash
+assert(testDB.adminCommand({ serverStatus: 1 }).ok);
+
+// Confirm that the rest of the shards did not crash
+mongos.getDB('config').shards.find().forEach(function (shardDoc){
+ var shardConn = new Mongo(shardDoc.host);
+ var adminDB = shardConn.getDB('admin');
+ var cmdResult = adminDB.runCommand({ serverStatus: 1 });
+
+ assert(cmdResult.ok, 'serverStatus on ' + shardDoc.host +
+ ' failed, result: ' + tojson(cmdResult));
+});
+