Use case – testing concurrency in the BookSwap application
The last section of this chapter is dedicated to the detection of concurrency issues in the BookSwap
web application. We will make use of Go’s race detector, alongside the testing strategies we have learned so far, to see what issues we can discover in the BookSwap
application.
You might be wondering why we would worry about the concurrency aspects of the BookSwap
application, since we have not used any locks, channels, or goroutines in the code base we have seen so far. Go’s net/http
library uses goroutines under the hood to serve HTTP requests, so the application can still have concurrency issues, even though it does not explicitly create its own goroutines and channels. This effect will be further amplified once the BookSwap
application gets converted from a monolithic application to running in the microservice architecture we discussed in Chapter 8, Testing Microservice Architectures.
We already...