Adding the batch mode test exposed some other problems in the gtests.
There are a few categories of changes here:
- Wait for acknowledgments after sending a request and getting a response. This is helpful because sending an acknowledgment requires calling into the client, and this was often happening after the test was finished, which could cause the client to be recreated at weird times. Note that this isn't possible for all tests, but it is possible for most. This is also helpful in some cases because we weren't testing that setting autoAcknowledge (like all of our real use cases do right now) was actually causing acknowledgments to be sent.
- When waiting for acknowledgments, be tolerant to the fact that other operations might be going on, and just look for the request token that the code is interested in instead of asserting that the number of acknowledgements is what we expect.
- When killing the agent (for testing purposes) and starting the agent again, call SendSimpleRequestAndWaitForResponse() to force the client to be created before the end of the test and avoid issues like #1 above.
There are a few other very small things I'll flag as review comments.