Skip to content

Commit 5049a15

Browse files
Add integration test suite for the plugin (#42)
Signed-off-by: Andriy Redko <andriy.redko@aiven.io> (cherry picked from commit 63c0cd5) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent f5a86ff commit 5049a15

File tree

2 files changed

+80
-1
lines changed

2 files changed

+80
-1
lines changed

build.gradle

+42-1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ plugins {
3737
apply plugin: 'opensearch.opensearchplugin'
3838
apply plugin: 'opensearch.internal-cluster-test'
3939
apply plugin: 'opensearch.pluginzip'
40+
apply plugin: 'opensearch.rest-test'
4041

4142
repositories {
4243
mavenLocal()
@@ -147,6 +148,46 @@ tasks.withType(Javadoc).configureEach { Javadoc javadoc ->
147148
javadoc.options.addStringOption("-release", java.targetCompatibility.majorVersion)
148149
}
149150

150-
testingConventions.enabled = false
151151
loggerUsageCheck.enabled = false
152152
validateNebulaPom.enabled = false
153+
154+
sourceSets {
155+
integTest {
156+
java {
157+
srcDirs file("src/integrationTest/java")
158+
}
159+
compileClasspath += sourceSets["main"].output + configurations["testRuntimeClasspath"]
160+
runtimeClasspath += output + compileClasspath
161+
}
162+
}
163+
164+
tasks.named("testingConventions").configure {
165+
naming.clear()
166+
naming {
167+
Tests {
168+
baseClass "org.apache.lucene.tests.util.LuceneTestCase"
169+
}
170+
IT {
171+
baseClass "org.opensearch.test.OpenSearchIntegTestCase"
172+
baseClass "org.opensearch.test.OpenSearchSingleNodeTestCase"
173+
}
174+
}
175+
}
176+
177+
integTest {
178+
description = "Run tests against a cluster"
179+
testClassesDirs = sourceSets.integTest.output.classesDirs
180+
classpath = sourceSets.integTest.runtimeClasspath
181+
182+
dependsOn "bundlePlugin"
183+
systemProperty 'tests.security.manager', 'true'
184+
185+
systemProperty "https", System.getProperty("https")
186+
systemProperty "user", System.getProperty("user")
187+
systemProperty "password", System.getProperty("password")
188+
}
189+
190+
testClusters.integTest {
191+
testDistribution = "ARCHIVE"
192+
plugin(project.tasks.bundlePlugin.archiveFile)
193+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* SPDX-License-Identifier: Apache-2.0
3+
*
4+
* The OpenSearch Contributors require contributions made to
5+
* this file be licensed under the Apache-2.0 license or a
6+
* compatible open source license.
7+
*/
8+
9+
package org.opensearch.index.codec.rest;
10+
11+
import org.opensearch.cluster.metadata.IndexMetadata;
12+
import org.opensearch.common.settings.Settings;
13+
import org.opensearch.test.rest.OpenSearchRestTestCase;
14+
15+
import java.io.IOException;
16+
17+
import static org.opensearch.index.codec.customcodecs.CustomCodecService.ZSTD_CODEC;
18+
import static org.opensearch.index.codec.customcodecs.CustomCodecService.ZSTD_NO_DICT_CODEC;
19+
20+
public class CreateIndexWithCodecIT extends OpenSearchRestTestCase {
21+
22+
public void testCreateIndexWithZstdCodec() throws IOException {
23+
final String index = "test-index";
24+
25+
// creating index
26+
createIndex(
27+
index,
28+
Settings.builder()
29+
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
30+
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
31+
.put("index.codec", randomFrom(ZSTD_CODEC, ZSTD_NO_DICT_CODEC))
32+
.put("index.codec.compression_level", randomIntBetween(1, 6))
33+
.build()
34+
);
35+
36+
ensureGreen(index);
37+
}
38+
}

0 commit comments

Comments
 (0)