Port HIVE-6211 to robustify the test