diff options
author | dwight <dwight@10gen.com> | 2011-07-23 11:54:34 -0400 |
---|---|---|
committer | dwight <dwight@10gen.com> | 2011-07-23 11:54:34 -0400 |
commit | f6b83ae5777f47660e0e0cc64042c35eeee9176b (patch) | |
tree | 589601c867b304415164e3b68d4fda76b63846de /jstests/profile1.js | |
parent | c98880c44af9725e785d387691d1b9ea7bf9465e (diff) | |
download | mongo-f6b83ae5777f47660e0e0cc64042c35eeee9176b.tar.gz |
buildbot attempt fix profile1.js
Diffstat (limited to 'jstests/profile1.js')
-rw-r--r-- | jstests/profile1.js | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/jstests/profile1.js b/jstests/profile1.js index eed64f60ae2..4778443b138 100644 --- a/jstests/profile1.js +++ b/jstests/profile1.js @@ -1,3 +1,4 @@ +print("profile1.js BEGIN"); try { @@ -59,11 +60,28 @@ try { db.eval( "sleep(25)" ) db.eval( "sleep(120)" ) after = db.system.profile.count() - assert.eq( before + 3 , after , "X1" ) + assert.eq( before + 3 , after , "X1" )
+
+ /* sleep() could be inaccurate on certain platforms. let's check */
+ print("\nsleep 2 time actual:");
+ for (var i = 0; i < 4; i++) {
+ print(db.eval("var x = new Date(); sleep(2); return new Date() - x;"));
+ }
+ print();
+ print("\nsleep 20 times actual:");
+ for (var i = 0; i < 4; i++) {
+ print(db.eval("var x = new Date(); sleep(20); return new Date() - x;"));
+ }
+ print();
+ print("\nsleep 120 times actual:");
+ for (var i = 0; i < 4; i++) {
+ print(db.eval("var x = new Date(); sleep(120); return new Date() - x;"));
+ }
+ print(); db.setProfilingLevel(1,100); before = db.system.profile.count(); - db.eval( "sleep(25)" ) + db.eval( "sleep(15)" ) db.eval( "sleep(120)" ) after = db.system.profile.count() assert.eq( before + 1 , after , "X2 : " + getProfileAString() ) @@ -74,8 +92,7 @@ try { db.eval( "sleep(120)" ) after = db.system.profile.count() assert.eq( before + 2 , after , "X3 : " + getProfileAString() ) - - + db.profile.drop(); db.setProfilingLevel(2) var q = { _id : 5 }; @@ -84,8 +101,10 @@ try { var r = db.system.profile.find().sort( { $natural : -1 } )[0] assert.eq( q , r.query , "Y1" ); assert.eq( u , r.updateobj , "Y2" ); - assert.eq( "update" , r.op , "Y3" ); - assert.eq( "test.profile1" , r.ns , "Y4" ); + assert.eq( "update" , r.op , "Y3" );
+ assert.eq("test.profile1", r.ns, "Y4");
+
+ print("profile1.js SUCCESS OK"); } finally { // disable profiling for subsequent tests |