diff options
author | Randolph Tan <randolph@10gen.com> | 2014-01-14 14:09:42 -0500 |
---|---|---|
committer | Randolph Tan <randolph@10gen.com> | 2014-02-28 16:26:33 -0500 |
commit | 5595b945603b0712c537787e31e6da661c424fee (patch) | |
tree | 90945ee3fe4931032f3af2d397bb755fbf5d30ef /jstests/core/explain8.js | |
parent | cd62080dcb036e83f8fca6d68d9bcab67bf7a21c (diff) | |
download | mongo-5595b945603b0712c537787e31e6da661c424fee.tar.gz |
SERVER-12127 migrate js tests to jscore suite when not related to writes
Moved test jstest/[a-i].js -> jstests/core/ and made changes to comply with write command api
Diffstat (limited to 'jstests/core/explain8.js')
-rw-r--r-- | jstests/core/explain8.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/jstests/core/explain8.js b/jstests/core/explain8.js new file mode 100644 index 00000000000..fde6adbd8f4 --- /dev/null +++ b/jstests/core/explain8.js @@ -0,0 +1,24 @@ +// Test calculation of the 'millis' field in explain output. + +t = db.jstests_explain8; +t.drop(); + +t.ensureIndex( { a:1 } ); +for( i = 1000; i < 4000; i += 1000 ) { + t.save( { a:i } ); +} + +// Run a query with one $or clause per a-value, each of which sleeps for 'a' milliseconds. +function slow() { + sleep( this.a ); + return true; +} +clauses = []; +for( i = 1000; i < 4000; i += 1000 ) { + clauses.push( { a:i, $where:slow } ); +} +explain = t.find( { $or:clauses } ).explain( true ); +//printjson( explain ); + +// Verify the duration of the whole query, and of each clause. +assert.gt( explain.millis, 1000 - 500 + 2000 - 500 + 3000 - 500 ); |