Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-27324

Implement types to facilitate writing C++ integration tests

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

            Assignee:
            backlog-server-servicearch [DO NOT USE] Backlog - Service Architecture
            Reporter:
            samantha.ritter@mongodb.com Samantha Ritter (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: