Skip to content

Commit

Permalink
buildbot attempt fix profile1.js
Browse files Browse the repository at this point in the history
  • Loading branch information
dwight committed Jul 23, 2011
1 parent c98880c commit f6b83ae
Showing 1 changed file with 25 additions and 6 deletions.
31 changes: 25 additions & 6 deletions jstests/profile1.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
print("profile1.js BEGIN");

try {

Expand Down Expand Up @@ -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() )
Expand All @@ -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 };
Expand All @@ -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
Expand Down

0 comments on commit f6b83ae

Please sign in to comment.