Fix range cache unittest by checking for KeyMax