Implement types to facilitate writing C++ integration tests

XMLWordPrintableJSON

    • Service Arch
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      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:
              [DO NOT USE] Backlog - Service Architecture
              Reporter:
              Samantha Ritter (Inactive)
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: