Skip to content

Commit ef3d7b6

Browse files
CI: Geo-Spatial Plugin integration test (#3244)
Signed-off-by: Andy Kwok <[email protected]>
1 parent becf303 commit ef3d7b6

File tree

2 files changed

+62
-0
lines changed

2 files changed

+62
-0
lines changed

integ-test/build.gradle

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,9 @@ dependencies {
199199
// Needed for BWC tests
200200
zipArchive group: 'org.opensearch.plugin', name:'opensearch-job-scheduler', version: "${opensearch_build}"
201201
zipArchive group: 'org.opensearch.plugin', name:'opensearch-sql-plugin', version: "${bwcVersion}-SNAPSHOT"
202+
203+
// For GeoIP PPL functions
204+
zipArchive group: 'org.opensearch.plugin', name:'geospatial', version: "${opensearch_build}"
202205
}
203206

204207
java {
@@ -242,16 +245,27 @@ def getJobSchedulerPlugin() {
242245
})
243246
}
244247

248+
def getGeoSpatialPlugin() {
249+
provider { (RegularFile) (() ->
250+
configurations.zipArchive.asFileTree.matching {
251+
include '**/geospatia*'
252+
}.singleFile )
253+
}
254+
}
255+
256+
245257
testClusters {
246258
integTest {
247259
testDistribution = 'archive'
248260
plugin(getJobSchedulerPlugin())
261+
plugin(getGeoSpatialPlugin())
249262
plugin ":opensearch-sql-plugin"
250263
setting "plugins.query.datasources.encryption.masterkey", "1234567812345678"
251264
}
252265
remoteCluster {
253266
testDistribution = 'archive'
254267
plugin(getJobSchedulerPlugin())
268+
plugin(getGeoSpatialPlugin())
255269
plugin ":opensearch-sql-plugin"
256270
}
257271
integTestWithSecurity {
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
*
3+
* Copyright OpenSearch Contributors
4+
* SPDX-License-Identifier: Apache-2.0
5+
*
6+
*/
7+
8+
package org.opensearch.sql.ppl;
9+
10+
import static org.opensearch.sql.legacy.TestUtils.getResponseBody;
11+
12+
import java.io.IOException;
13+
import lombok.SneakyThrows;
14+
import org.junit.Assert;
15+
import org.junit.jupiter.api.BeforeEach;
16+
import org.junit.jupiter.api.Test;
17+
import org.opensearch.client.Request;
18+
import org.opensearch.client.RequestOptions;
19+
import org.opensearch.client.Response;
20+
21+
/** IP enrichment PPL request with OpenSearch Geo-sptial plugin */
22+
public class GeoIpFunctionsIT extends PPLIntegTestCase {
23+
24+
private static boolean initialized = false;
25+
26+
private static String PLUGIN_NAME = "opensearch-geospatial";
27+
28+
@SneakyThrows
29+
@BeforeEach
30+
public void initialize() {
31+
if (!initialized) {
32+
setUpIndices();
33+
initialized = true;
34+
}
35+
}
36+
37+
@Test
38+
public void testGeoPluginInstallation() throws IOException {
39+
40+
Request request = new Request("GET", "/_cat/plugins?v");
41+
RequestOptions.Builder restOptionsBuilder = RequestOptions.DEFAULT.toBuilder();
42+
restOptionsBuilder.addHeader("Content-Type", "application/json");
43+
request.setOptions(restOptionsBuilder);
44+
Response response = client().performRequest(request);
45+
Assert.assertEquals(200, response.getStatusLine().getStatusCode());
46+
Assert.assertTrue(getResponseBody(response, true).contains(PLUGIN_NAME));
47+
}
48+
}

0 commit comments

Comments
 (0)