The test o.a.h.hdfs.server.namenode.TestNNStorageRetentionManager uses a HashMap(dirRoots) to store the root storages to be mocked for the purging test, which does not have any predictable order. The directories needs be purged are stored in a LinkedHashSet, which has a predictable order. So, when the directories get mocked for the test, they could be already out of
the order that they were added. Thus, the order that the directories were
actually purged and the order of them being added to the LinkedHashList could
be different and cause the test to fail.