Check if nodes have been shut down in TestCluster#beforeTest

The test cluster ignored randomly teared down nodes in tests.
This commit also adds some debug logging to the TestCluster#beforeTest
method.