Skip to content

Commit

Permalink
Add integration test suite for the plugin (#42) (#44)
Browse files Browse the repository at this point in the history
(cherry picked from commit 63c0cd5)

Signed-off-by: Andriy Redko <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent f5a86ff commit fe253e1
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 1 deletion.
43 changes: 42 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ plugins {
apply plugin: 'opensearch.opensearchplugin'
apply plugin: 'opensearch.internal-cluster-test'
apply plugin: 'opensearch.pluginzip'
apply plugin: 'opensearch.rest-test'

repositories {
mavenLocal()
Expand Down Expand Up @@ -147,6 +148,46 @@ tasks.withType(Javadoc).configureEach { Javadoc javadoc ->
javadoc.options.addStringOption("-release", java.targetCompatibility.majorVersion)
}

testingConventions.enabled = false
loggerUsageCheck.enabled = false
validateNebulaPom.enabled = false

sourceSets {
integTest {
java {
srcDirs file("src/integrationTest/java")
}
compileClasspath += sourceSets["main"].output + configurations["testRuntimeClasspath"]
runtimeClasspath += output + compileClasspath
}
}

tasks.named("testingConventions").configure {
naming.clear()
naming {
Tests {
baseClass "org.apache.lucene.tests.util.LuceneTestCase"
}
IT {
baseClass "org.opensearch.test.OpenSearchIntegTestCase"
baseClass "org.opensearch.test.OpenSearchSingleNodeTestCase"
}
}
}

integTest {
description = "Run tests against a cluster"
testClassesDirs = sourceSets.integTest.output.classesDirs
classpath = sourceSets.integTest.runtimeClasspath

dependsOn "bundlePlugin"
systemProperty 'tests.security.manager', 'true'

systemProperty "https", System.getProperty("https")
systemProperty "user", System.getProperty("user")
systemProperty "password", System.getProperty("password")
}

testClusters.integTest {
testDistribution = "ARCHIVE"
plugin(project.tasks.bundlePlugin.archiveFile)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/

package org.opensearch.index.codec.rest;

import org.opensearch.cluster.metadata.IndexMetadata;
import org.opensearch.common.settings.Settings;
import org.opensearch.test.rest.OpenSearchRestTestCase;

import java.io.IOException;

import static org.opensearch.index.codec.customcodecs.CustomCodecService.ZSTD_CODEC;
import static org.opensearch.index.codec.customcodecs.CustomCodecService.ZSTD_NO_DICT_CODEC;

public class CreateIndexWithCodecIT extends OpenSearchRestTestCase {

public void testCreateIndexWithZstdCodec() throws IOException {
final String index = "test-index";

// creating index
createIndex(
index,
Settings.builder()
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
.put("index.codec", randomFrom(ZSTD_CODEC, ZSTD_NO_DICT_CODEC))
.put("index.codec.compression_level", randomIntBetween(1, 6))
.build()
);

ensureGreen(index);
}
}

0 comments on commit fe253e1

Please sign in to comment.