tests: fix autorestart test logic