Refactor repl_bucket_types test to eliminate race condition and reduce code duplication