Add tests for populate_x_metadata (#1408)