unit test fix for #3052 and #3053

In graceful shutdown why do we need these helper methods like ```isInSafeState```? Afaik graceful shutdown should handle all this kind of scenarios since it is graceful.