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 changed the code in memory package so that it will return stats in chronological order. But I did not check the order in the unit test. As long as they are most recent stats, they will be fine.