Graceful shutdown is an important mechanism to deal with suddent sever shutdown or termnination signal. Here, we will explore how to implement graceful shutdown ig Go and how to test it.
Testing multi-threaded code is tricky, the test and the code under test most likely are run under different threads. Here, we will discuss how to deal with the issue based on the book Growing Object-Oriented Software Guided by Tests