-
Type: Task
-
Resolution: Won't Do
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Testing Infrastructure
-
Service Arch
In SERVER-19449 we did work to connect C++ integration tests with a running server. The existing scaffolding doesn't provide a client implementation to talk to the running server, this is left to the test author to write.
To make it easier to write C++ integration tests, we should build on the existing scaffolding to provide an API that looks something like this:
IntegrationTestClient mongod; ASSERT_OK(mongod.connect(unittest::getFixtureConnectionString())); // Test something simple, like running a ping ASSERT_OK(mongod.sendCommand({ "ping" : 1 }));
Alternately, this library could hook in at the ServiceEntryPoint level, for networkless testing that doesn't require a running mongod.
// StandaloneClient is a ServiceEntryPoint with one implicit transport::session, it uses the // test thread to call directly into assembleResponse. Also handles wrapping and unwrapping // of BSON to Messages for convenience, implicitly or explicitly. StandaloneClient mongod; ASSERT_OK(mongod.runCommand({ "ping" : 1 })); ASSERT_OK(mongod.runCommand(toMessage({ "ping" : 1 })));