Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: Geo-Spatial Plugin integration test #3244

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions integ-test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,9 @@ dependencies {
// Needed for BWC tests
zipArchive group: 'org.opensearch.plugin', name:'opensearch-job-scheduler', version: "${opensearch_build}"
zipArchive group: 'org.opensearch.plugin', name:'opensearch-sql-plugin', version: "${bwcVersion}-SNAPSHOT"

// For GeoIP PPL functions
zipArchive group: 'org.opensearch.plugin', name:'geospatial', version: "${opensearch_build}"
}

java {
Expand Down Expand Up @@ -242,16 +245,27 @@ def getJobSchedulerPlugin() {
})
}

def getGeoSpatialPlugin() {
provider { (RegularFile) (() ->
configurations.zipArchive.asFileTree.matching {
include '**/geospatia*'
}.singleFile )
}
}


testClusters {
integTest {
testDistribution = 'archive'
plugin(getJobSchedulerPlugin())
plugin(getGeoSpatialPlugin())
plugin ":opensearch-sql-plugin"
setting "plugins.query.datasources.encryption.masterkey", "1234567812345678"
}
remoteCluster {
testDistribution = 'archive'
plugin(getJobSchedulerPlugin())
plugin(getGeoSpatialPlugin())
plugin ":opensearch-sql-plugin"
}
integTestWithSecurity {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*
*/

package org.opensearch.sql.ppl;

import static org.opensearch.sql.legacy.TestUtils.getResponseBody;

import java.io.IOException;
import lombok.SneakyThrows;
import org.junit.Assert;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.opensearch.client.Request;
import org.opensearch.client.RequestOptions;
import org.opensearch.client.Response;

/** IP enrichment PPL request with OpenSearch Geo-sptial plugin */
public class GeoIpFunctionsIT extends PPLIntegTestCase {

private static boolean initialized = false;

private static String PLUGIN_NAME = "opensearch-geospatial";

@SneakyThrows
@BeforeEach
public void initialize() {
if (!initialized) {
setUpIndices();
initialized = true;
}
}

@Test
public void testGeoPluginInstallation() throws IOException {

Request request = new Request("GET", "/_cat/plugins?v");
RequestOptions.Builder restOptionsBuilder = RequestOptions.DEFAULT.toBuilder();
restOptionsBuilder.addHeader("Content-Type", "application/json");
request.setOptions(restOptionsBuilder);
Response response = client().performRequest(request);
Assert.assertEquals(200, response.getStatusLine().getStatusCode());
Assert.assertTrue(getResponseBody(response, true).contains(PLUGIN_NAME));
}
}
Loading