refact(controller): Decouple listeners/servers shutdown from Worker

In general, these changes were introduced in the same vein of the
changes to controller `startListeners`.

Specifically, these changes also decouple the Controller and the Worker
shutdown processes. Currently, a call to `stopListeners` on an instance
that is running as both a Controller and a Worker would stop the
listeners for both.

Lastly, we also add unit/integration tests to the shutdown code.
This commit is contained in:
Hugo Vieira committed 2022-03-25 15:04:23 +00:00
1 parent d438a6d2dd
commit eebdfb88dc
9 files changed
+572 -72

No files matched your search

@@ -64,7 +64,7 @@ func TestMultiControllerMultiWorkerConnections(t *testing.T) {
expectWorkers(t, c1, w1, w2)
expectWorkers(t, c2, w1, w2)
require.NoError(c1.Controller().Shutdown(true))
require.NoError(c2.Controller().Shutdown())
time.Sleep(10 * time.Second)
expectWorkers(t, c2, w1, w2)