[SERVER-27324] Implement types to facilitate writing C++ integration tests Created: 07/Dec/16  Updated: 28/Mar/23  Resolved: 28/Mar/23

Status: Closed
Project: Core Server
Component/s: Testing Infrastructure
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: Samantha Ritter (Inactive) Assignee: Backlog - Service Architecture
Resolution: Won't Do Votes: 1
Labels: devtools-to-servicearch, re-triaged-ticket
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Service Arch
Participants:

 Description   

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 })));



 Comments   
Comment by Lauren Lewis (Inactive) [ 24/Feb/22 ]

We haven’t heard back from you for at least one calendar year, so this issue is being closed. If this is still an issue for you, please provide additional information and we will reopen the ticket.

Generated at Thu Feb 08 04:14:50 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.