diff options
author | Bernard Gorman <bernard.gorman@gmail.com> | 2021-03-24 14:07:04 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-04-02 21:51:14 +0000 |
commit | ea51edf33aa685e8b8d4692ee42b8c0e8e9cfb98 (patch) | |
tree | a3866340e9e80201eb9c9b675200700cc30ad53d /src/mongo/db/explain_test.cpp | |
parent | 0198bcfb938ccd788f90a2f5e6156871cf18330f (diff) | |
download | mongo-ea51edf33aa685e8b8d4692ee42b8c0e8e9cfb98.tar.gz |
SERVER-54975 Rename IDL parser classes to use CommandRequest and CommandReply suffixes
Diffstat (limited to 'src/mongo/db/explain_test.cpp')
-rw-r--r-- | src/mongo/db/explain_test.cpp | 62 |
1 files changed, 33 insertions, 29 deletions
diff --git a/src/mongo/db/explain_test.cpp b/src/mongo/db/explain_test.cpp index 9b7d3df9c06..866574f0fc5 100644 --- a/src/mongo/db/explain_test.cpp +++ b/src/mongo/db/explain_test.cpp @@ -60,58 +60,62 @@ TEST(ExplainTest, ExplainSerializeToBSONCorrectly) { } TEST(ExplainTest, CanParseExplainVerbosity) { - auto verbosity = - ExplainCmd::parse(IDLParserErrorContext("explain"), - fromjson("{explain: {}, verbosity: 'queryPlanner', $db: 'dummy'}")) - .getVerbosity(); + auto verbosity = ExplainCommandRequest::parse( + IDLParserErrorContext("explain"), + fromjson("{explain: {}, verbosity: 'queryPlanner', $db: 'dummy'}")) + .getVerbosity(); ASSERT(verbosity == Verbosity::kQueryPlanner); - verbosity = - ExplainCmd::parse(IDLParserErrorContext("explain"), - fromjson("{explain: {}, verbosity: 'executionStats', $db: 'dummy'}")) - .getVerbosity(); + verbosity = ExplainCommandRequest::parse( + IDLParserErrorContext("explain"), + fromjson("{explain: {}, verbosity: 'executionStats', $db: 'dummy'}")) + .getVerbosity(); ASSERT(verbosity == Verbosity::kExecStats); - verbosity = - ExplainCmd::parse(IDLParserErrorContext("explain"), - fromjson("{explain: {}, verbosity: 'allPlansExecution', $db: 'dummy'}")) - .getVerbosity(); + verbosity = ExplainCommandRequest::parse( + IDLParserErrorContext("explain"), + fromjson("{explain: {}, verbosity: 'allPlansExecution', $db: 'dummy'}")) + .getVerbosity(); ASSERT(verbosity == Verbosity::kExecAllPlans); } TEST(ExplainTest, ParsingFailsIfVerbosityIsNotAString) { - ASSERT_THROWS_CODE(ExplainCmd::parse(IDLParserErrorContext("explain"), - fromjson("{explain: {}, verbosity: 1}")), - DBException, - ErrorCodes::TypeMismatch); - ASSERT_THROWS_CODE(ExplainCmd::parse(IDLParserErrorContext("explain"), - fromjson("{explain: {}, verbosity: {foo: 'bar'}}")), + ASSERT_THROWS_CODE(ExplainCommandRequest::parse(IDLParserErrorContext("explain"), + fromjson("{explain: {}, verbosity: 1}")), DBException, ErrorCodes::TypeMismatch); + ASSERT_THROWS_CODE( + ExplainCommandRequest::parse(IDLParserErrorContext("explain"), + fromjson("{explain: {}, verbosity: {foo: 'bar'}}")), + DBException, + ErrorCodes::TypeMismatch); } TEST(ExplainTest, ParsingFailsIfVerbosityStringIsNotRecognized) { - ASSERT_THROWS_CODE(ExplainCmd::parse(IDLParserErrorContext("explain"), - fromjson("{explain: {}, verbosity: 'badVerbosity'}")), - DBException, - ErrorCodes::BadValue); + ASSERT_THROWS_CODE( + ExplainCommandRequest::parse(IDLParserErrorContext("explain"), + fromjson("{explain: {}, verbosity: 'badVerbosity'}")), + DBException, + ErrorCodes::BadValue); } TEST(ExplainTest, ParsingFailsIfFirstElementIsNotAnObject) { - ASSERT_THROWS_CODE(ExplainCmd::parse(IDLParserErrorContext("explain"), - fromjson("{explain: 1, verbosity: 'queryPlanner'}")), - DBException, - 40414); + ASSERT_THROWS_CODE( + ExplainCommandRequest::parse(IDLParserErrorContext("explain"), + fromjson("{explain: 1, verbosity: 'queryPlanner'}")), + DBException, + 40414); } TEST(ExplainTest, ParsingFailsIfUnknownFieldInCommandObject) { ASSERT_THROWS_CODE( - ExplainCmd::parse(IDLParserErrorContext("explain"), - fromjson("{explain: {}, verbosity: 'queryPlanner', unknownField: true}")), + ExplainCommandRequest::parse( + IDLParserErrorContext("explain"), + fromjson("{explain: {}, verbosity: 'queryPlanner', unknownField: true}")), DBException, 40415); } TEST(ExplainTest, CanParseGenericCommandArguments) { - ExplainCmd::parse( + ExplainCommandRequest::parse( IDLParserErrorContext("explain"), fromjson("{explain: {}, verbosity: 'queryPlanner', comment: true, $db: 'test'}")); } |