The test assumes that the last inserted measurement will be in the last inserted bucket. There's no guarantee of that being always true. This issue was revealed after SERVER-61194, where the instance bytes of the ObjectId can be different on the same process as they get modified to prevent the risk of overflowing if a lot of buckets are being generated.