Retry if object listing fails
Remove duplication in tests