summaryrefslogtreecommitdiff
path: root/jstests/profile3.js
diff options
context:
space:
mode:
authorAaron <aaron@10gen.com>2012-03-14 22:18:12 -0700
committerAaron <aaron@10gen.com>2012-03-22 13:09:51 -0700
commit6501a582a0bd97cd126b0257b29e7749869a95cc (patch)
tree989e22af1ba82980d31be29be4592390c0962696 /jstests/profile3.js
parent3d8adc091015f90acc239ad2c20d3cf05f5d4831 (diff)
downloadmongo-6501a582a0bd97cd126b0257b29e7749869a95cc.tar.gz
SERVER-5293 Run some profile js tests from test specific user roles and filter the profile collection based on user name to exclude slave clone operations.
Diffstat (limited to 'jstests/profile3.js')
-rw-r--r--jstests/profile3.js22
1 files changed, 16 insertions, 6 deletions
diff --git a/jstests/profile3.js b/jstests/profile3.js
index 98812abc48f..1d823763573 100644
--- a/jstests/profile3.js
+++ b/jstests/profile3.js
@@ -6,11 +6,21 @@ var db = db.getSisterDB("profile3");
t = db.profile3;
t.drop();
+function profileCursor( query ) {
+ query = query || {};
+ Object.extend( query, { user:username } );
+ return db.system.profile.find( query );
+}
+
try {
+ username = "jstests_profile3_user";
+ db.addUser( username, "password" );
+ db.auth( username, "password" );
+
db.setProfilingLevel(0);
db.system.profile.drop();
- assert.eq( 0 , db.system.profile.count() )
+ assert.eq( 0 , profileCursor().count() )
db.setProfilingLevel(2);
@@ -21,15 +31,15 @@ try {
t.update( { x : 1 }, {$inc:{a:1}} );
t.update( { x : 0 }, {$inc:{a:1}} );
- db.system.profile.find().forEach( printjson )
+ profileCursor().forEach( printjson )
db.setProfilingLevel(0);
- assert.eq(db.system.profile.count({nupdated: {$exists:1}}), 3)
- assert.eq(db.system.profile.count({nupdated: 1}), 2)
- assert.eq(db.system.profile.count({nupdated: 0}), 1)
- assert.eq(db.system.profile.count({nmoved: 1}), 1)
+ assert.eq(profileCursor({nupdated: {$exists:1}}).count(), 3)
+ assert.eq(profileCursor({nupdated: 1}).count(), 2)
+ assert.eq(profileCursor({nupdated: 0}).count(), 1)
+ assert.eq(profileCursor({nmoved: 1}).count(), 1)
db.system.profile.drop();