diff options
author | Eric Cox <eric.cox@mongodb.com> | 2020-06-30 21:45:29 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-06-30 21:58:41 +0000 |
commit | 6d650280c2d21c24dc2c45d1d41e915f4d244ffa (patch) | |
tree | 2c0f61cf05c98adcae842f06c2c455f3f7de5203 /jstests/core | |
parent | 7917051ba59a15fddf70493ffe50ec28289523ae (diff) | |
download | mongo-6d650280c2d21c24dc2c45d1d41e915f4d244ffa.tar.gz |
Revert SERVER-48742 Log changes to profiler settings
Diffstat (limited to 'jstests/core')
-rw-r--r-- | jstests/core/apitest_db_profile_level.js | 43 |
1 files changed, 8 insertions, 35 deletions
diff --git a/jstests/core/apitest_db_profile_level.js b/jstests/core/apitest_db_profile_level.js index 18ed2384726..adfc2b0ee43 100644 --- a/jstests/core/apitest_db_profile_level.js +++ b/jstests/core/apitest_db_profile_level.js @@ -6,62 +6,35 @@ (function() { 'use strict'; -load("jstests/libs/log.js"); // For findMatchingLogLine, findMatchingLogLines. - /* * be sure the public collection API is complete */ assert(db.getProfilingLevel, "getProfilingLevel"); assert(db.setProfilingLevel, "setProfilingLevel"); -// Checks for the log that was expected to be created when profile level changed. -function profilerChangeWasLogged({from, to} = {}) { - const globalLog = assert.commandWorked(profileLevelDB.adminCommand({getLog: "global"})); - const fieldMatcher = {msg: "Profiler settings changed"}; - if (from && to) { - const lines = [...findMatchingLogLines(globalLog.log, fieldMatcher)]; - return lines.find(line => line.match(new RegExp(/"from":{/.source + from.source)) && - line.match(new RegExp(/"to":{/.source + to.source))); - } else { - return findMatchingLogLine(globalLog.log, fieldMatcher); - } -} - // A test-specific database is used for profiler testing so as not to interfere with // other tests that modify profiler level, when run in parallel. var profileLevelDB = db.getSiblingDB("apitest_db_profile_level"); -profileLevelDB.getProfilingLevel(); -assert(!profilerChangeWasLogged(), "Didn't expect anything to be logged"); - -assert.throws(() => { - profileLevelDB.setProfilingLevel(-1); -}); -assert(!profilerChangeWasLogged(), "Didn't expect anything to be logged"); - profileLevelDB.setProfilingLevel(0); assert(profileLevelDB.getProfilingLevel() == 0, "prof level 0"); -assert(profilerChangeWasLogged({from: /"level":0/, to: /"level":0/}), - "Didn't find expected log line"); profileLevelDB.setProfilingLevel(1); assert(profileLevelDB.getProfilingLevel() == 1, "p1"); -assert(profilerChangeWasLogged({from: /"level":0/, to: /"level":1/}), - "Didn't find expected log line"); profileLevelDB.setProfilingLevel(2); assert(profileLevelDB.getProfilingLevel() == 2, "p2"); -assert(profilerChangeWasLogged({from: /"level":1/, to: /"level":2/}), - "Didn't find expected log line"); profileLevelDB.setProfilingLevel(0); assert(profileLevelDB.getProfilingLevel() == 0, "prof level 0"); -assert(profilerChangeWasLogged({from: /"level":2/, to: /"level":0/}), - "Didn't find expected log line"); -assert.throws(() => { +var asserted = false; +try { profileLevelDB.setProfilingLevel(10); -}); -// Check that didn't log an invalid profile level change. -assert(!profilerChangeWasLogged({from: /"level":0/, to: /"level":10/}), "Didn't expect log line"); + assert(false); +} catch (e) { + asserted = true; + assert(e.dbSetProfilingException); +} +assert(asserted, "should have asserted"); })(); |