Update sharding tests to handle narrowed localhost exception