Remove race condition in tests by using proper restart strategy