From 153e62ab1a25a7ed4eb80dd53eb32f55ecb90621 Mon Sep 17 00:00:00 2001 From: Andy Kwok Date: Wed, 8 Jan 2025 17:22:04 -0800 Subject: [PATCH] Integ test for geoip Signed-off-by: Andy Kwok --- .../opensearch/sql/security/CrossClusterSearchIT.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/integ-test/src/test/java/org/opensearch/sql/security/CrossClusterSearchIT.java b/integ-test/src/test/java/org/opensearch/sql/security/CrossClusterSearchIT.java index 63067f8c16..fd604939c5 100644 --- a/integ-test/src/test/java/org/opensearch/sql/security/CrossClusterSearchIT.java +++ b/integ-test/src/test/java/org/opensearch/sql/security/CrossClusterSearchIT.java @@ -127,9 +127,17 @@ public void testGeoIpEnrichment() { rows("Test user - USA", "10.1.1.1"), rows("Test user - Canada", "127.1.1.1")); -// JSONObject resultGeoIp = executeQuery(String.format("search source=%s", TEST_INDEX_GEOIP_REMOTE)); + JSONObject resultGeoIp = executeQuery( + String.format("search source=%s | eval enrichmentResult = geoip(\\\"%s\\\",%s)", + TEST_INDEX_GEOIP_REMOTE, "dummycityindex", "ip")); + verifyColumn(resultGeoIp, columnName("name"), columnName("ip"), columnName("enrichmentResult")); + verifyDataRows(resultGeoIp, + rows("Test user - USA", "10.1.1.1", Map.of("country", "USA", "city", "Seattle")), + rows("Test user - Canada", "127.1.1.1", Map.of("country", "Canada", "city", "Vancouver"))); +// Expected: iterable with items [[Test user - USA, 10.1.1.1, x], [Test user - Canada, 127.1.1.1, x]] in any order +// but: not matched: <["Test user - USA","10.1.1.1",{"country":"USA","city":"Seattle"}]> }