Skip to content

Commit 97cd7f2

Browse files
andy-k-improvingxinyual
authored andcommitted
CI: Geo-Spatial Plugin integration test (#3244)
Signed-off-by: Andy Kwok <[email protected]> Signed-off-by: xinyual <[email protected]>
1 parent 984987a commit 97cd7f2

File tree

3 files changed

+63
-1
lines changed

3 files changed

+63
-1
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
buildscript {
88
ext {
9-
opensearch_version = System.getProperty("opensearch.version", "2.19.3-SNAPSHOT")
9+
opensearch_version = System.getProperty("opensearch.version", "2.19.0-SNAPSHOT")
1010
isSnapshot = "true" == System.getProperty("build.snapshot", "true")
1111
buildVersionQualifier = System.getProperty("build.version_qualifier", "")
1212
version_tokens = opensearch_version.tokenize('-')

integ-test/build.gradle

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,9 @@ dependencies {
195195
testCompileOnly 'org.apiguardian:apiguardian-api:1.1.2'
196196

197197
zipArchive group: 'org.opensearch.plugin', name:'opensearch-job-scheduler', version: "${opensearch_build}"
198+
199+
// For GeoIP PPL functions
200+
zipArchive group: 'org.opensearch.plugin', name:'geospatial', version: "${opensearch_build}"
198201
}
199202

200203
dependencyLicenses.enabled = false
@@ -233,16 +236,27 @@ def getJobSchedulerPlugin() {
233236
})
234237
}
235238

239+
def getGeoSpatialPlugin() {
240+
provider { (RegularFile) (() ->
241+
configurations.zipArchive.asFileTree.matching {
242+
include '**/geospatia*'
243+
}.singleFile )
244+
}
245+
}
246+
247+
236248
testClusters {
237249
integTest {
238250
testDistribution = 'archive'
239251
plugin(getJobSchedulerPlugin())
252+
plugin(getGeoSpatialPlugin())
240253
plugin ":opensearch-sql-plugin"
241254
setting "plugins.query.datasources.encryption.masterkey", "1234567812345678"
242255
}
243256
remoteCluster {
244257
testDistribution = 'archive'
245258
plugin(getJobSchedulerPlugin())
259+
plugin(getGeoSpatialPlugin())
246260
plugin ":opensearch-sql-plugin"
247261
}
248262
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)