More unit tests for storage drivers and a bug fix for memory storage

This PR contains several unit tests. It also contains a bug fix for memory storage. The bug could be reproduced with the newly added unit tests in this PR.
I think I was trying to fix a bug. The previous version will return the earliest stats when calling ``RecentStats()``. The bug could be reproduced with ``TestRetrievePartialRecentStats``.