summaryrefslogtreecommitdiff
path: root/jstests/mr_killop.js
diff options
context:
space:
mode:
authoragirbal <antoine@10gen.com>2011-01-24 22:22:41 -0800
committeragirbal <antoine@10gen.com>2011-01-24 22:49:41 -0800
commit2846cea2e392344753e65523feb158ed0750c07b (patch)
treefe82567b084be8a0b627912ad83b310aed7f335a /jstests/mr_killop.js
parentfeb971d07c3e0bfc32c7961b9f91be18e71f71ef (diff)
downloadmongo-2846cea2e392344753e65523feb158ed0750c07b.tar.gz
fixed mr_killop test, was broken because reduce is not called for only 1 entry to reduce
Diffstat (limited to 'jstests/mr_killop.js')
-rw-r--r--jstests/mr_killop.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/jstests/mr_killop.js b/jstests/mr_killop.js
index 0dabe14771c..8d9ed209fe1 100644
--- a/jstests/mr_killop.js
+++ b/jstests/mr_killop.js
@@ -39,7 +39,8 @@ if ( typeof _threadInject == "undefined" ) { // don't run in v8 mode - SERVER-19
function testOne( map, reduce, finalize, scope, where, wait ) {
t.drop();
t2.drop();
- // Ensure we have one document for the m/r functions to run on.
+ // Ensure we have 2 documents for the reduce to run
+ t.save( {a:1} );
t.save( {a:1} );
db.getLastError();
@@ -89,14 +90,14 @@ if ( typeof _threadInject == "undefined" ) { // don't run in v8 mode - SERVER-19
/** Test looping in map and reduce functions */
function runMRTests( loop, where ) {
test( loop, function( k, v ) { return v[ 0 ]; }, null, null, where );
- test( function() { emit( this.id, 1 ); }, loop, null, null, where );
+ test( function() { emit( this.a, 1 ); }, loop, null, null, where );
test( function() { loop(); }, function( k, v ) { return v[ 0 ] }, null, { loop: loop }, where );
}
/** Test looping in finalize function */
function runFinalizeTests( loop, where ) {
- test( function() { emit( this.id, 1 ); }, function( k, v ) { return v[ 0 ] }, loop, null, where );
- test( function() { emit( this.id, 1 ); }, function( k, v ) { return v[ 0 ] }, function( a, b ) { loop() }, { loop: loop }, where );
+ test( function() { emit( this.a, 1 ); }, function( k, v ) { return v[ 0 ] }, loop, null, where );
+ test( function() { emit( this.a, 1 ); }, function( k, v ) { return v[ 0 ] }, function( a, b ) { loop() }, { loop: loop }, where );
}
var loop = function() {