[Rename] server/test/resources (#359)

This commit refactors all resources (files, naming, etc.) in the
server/test/resources directory to the new opensearch namespace.

Signed-off-by: Nicholas Walter Knize <nknize@apache.org>
This commit is contained in:
Nick Knize 2021-03-17 15:36:22 -05:00 committed by Nick Knize
parent 182a86ea63
commit e1e2c397fc
57 changed files with 35 additions and 33 deletions

View File

@ -1,4 +1,4 @@
import org.elasticsearch.gradle.info.BuildParams
import org.opensearch.gradle.info.BuildParams
/*
* Licensed to Elasticsearch under one or more contributor
@ -19,20 +19,20 @@ import org.elasticsearch.gradle.info.BuildParams
* under the License.
*/
apply plugin: 'elasticsearch.build'
apply plugin: 'opensearch.build'
apply plugin: 'nebula.optional-base'
apply plugin: 'elasticsearch.publish'
apply plugin: 'elasticsearch.internal-cluster-test'
apply plugin: 'opensearch.publish'
apply plugin: 'opensearch.internal-cluster-test'
publishing {
publications {
nebula {
artifactId 'elasticsearch'
artifactId 'opensearch'
}
}
}
archivesBaseName = 'elasticsearch'
archivesBaseName = 'opensearch'
// we want to keep the JDKs in our IDEs set to JDK 8 until minimum JDK is bumped to 11 so we do not include this source set in our IDEs
if (!isEclipse) {
@ -76,13 +76,13 @@ if (!isEclipse) {
dependencies {
api project(':libs:elasticsearch-core')
api project(':libs:elasticsearch-secure-sm')
api project(':libs:elasticsearch-x-content')
api project(":libs:elasticsearch-geo")
api project(':libs:opensearch-core')
api project(':libs:opensearch-secure-sm')
api project(':libs:opensearch-x-content')
api project(":libs:opensearch-geo")
compileOnly project(':libs:elasticsearch-plugin-classloader')
testRuntimeOnly project(':libs:elasticsearch-plugin-classloader')
compileOnly project(':libs:opensearch-plugin-classloader')
testRuntimeOnly project(':libs:opensearch-plugin-classloader')
// lucene
api "org.apache.lucene:lucene-core:${versions.lucene}"
@ -101,7 +101,7 @@ dependencies {
api "org.apache.lucene:lucene-suggest:${versions.lucene}"
// utilities
api project(":libs:elasticsearch-cli")
api project(":libs:opensearch-cli")
api 'com.carrotsearch:hppc:0.8.1'
// time handling, remove with java 8 time
@ -121,14 +121,14 @@ dependencies {
api "org.apache.logging.log4j:log4j-core:${versions.log4j}", optional
// repackaged jna with native bits linked against all elastic supported platforms
api "org.elasticsearch:jna:${versions.jna}"
api "org.opensearch:jna:${versions.jna}"
testImplementation(project(":test:framework")) {
// tests use the locally compiled version of server
exclude group: 'org.elasticsearch', module: 'server'
exclude group: 'org.opensearch', module: 'server'
}
internalClusterTestImplementation(project(":test:framework")) {
exclude group: 'org.elasticsearch', module: 'server'
exclude group: 'org.opensearch', module: 'server'
}
}
@ -167,8 +167,8 @@ tasks.named("testingConventions").configure {
baseClass "org.apache.lucene.util.LuceneTestCase"
}
IT {
baseClass "org.elasticsearch.test.ESIntegTestCase"
baseClass "org.elasticsearch.test.ESSingleNodeTestCase"
baseClass "org.opensearch.test.ESIntegTestCase"
baseClass "org.opensearch.test.ESSingleNodeTestCase"
}
}
}
@ -322,8 +322,8 @@ tasks.named("thirdPartyAudit").configure {
tasks.named("dependencyLicenses").configure {
mapping from: /lucene-.*/, to: 'lucene'
dependencies = project.configurations.runtimeClasspath.fileCollection {
it.group.startsWith('org.elasticsearch') == false ||
// keep the following org.elasticsearch jars in
it.group.startsWith('org.opensearch') == false ||
// keep the following org.opensearch jars in
(it.name == 'jna' ||
it.name == 'securesm')
}
@ -331,9 +331,9 @@ tasks.named("dependencyLicenses").configure {
tasks.named("licenseHeaders").configure {
// Ignore our vendored version of Google Guice
excludes << 'org/elasticsearch/common/inject/**/*'
excludes << 'org/opensearch/common/inject/**/*'
// Ignore temporary copies of impending 8.7 Lucene classes
excludes << 'org/apache/lucene/search/RegExp87*'
excludes << 'org/apache/lucene/search/RegexpQuery87*'
excludes << 'org/elasticsearch/client/documentation/placeholder.txt'
excludes << 'org/opensearch/client/documentation/placeholder.txt'
}

View File

@ -1202,7 +1202,7 @@ public class SettingTests extends ESTestCase {
final Settings settings = Settings.builder().setSecureSettings(secureSettings).build();
Setting<String> setting = Setting.simpleString("foo", Property.NodeScope);
IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> setting.get(settings));
assertThat(e.getMessage(), containsString("must be stored inside elasticsearch.yml"));
assertThat(e.getMessage(), containsString("must be stored inside opensearch.yml"));
}
@TestLogging(value="org.opensearch.common.settings.IndexScopedSettings:INFO",

View File

@ -26,7 +26,7 @@ import org.opensearch.common.settings.SecureString;
import org.opensearch.common.settings.Setting;
import org.opensearch.common.settings.Settings;
import org.opensearch.common.settings.SettingsException;
import org.elasticsearch.env.Environment;
import org.opensearch.env.Environment;
import org.elasticsearch.test.ESTestCase;
import org.junit.After;
import org.junit.Before;
@ -82,7 +82,7 @@ public class InternalSettingsPreparerTests extends ESTestCase {
public void testDefaultClusterName() {
Settings settings = InternalSettingsPreparer.prepareSettings(Settings.EMPTY);
assertEquals("elasticsearch", settings.get("cluster.name"));
assertEquals("opensearch", settings.get("cluster.name"));
settings = InternalSettingsPreparer.prepareSettings(Settings.builder().put("cluster.name", "foobar").build());
assertEquals("foobar", settings.get("cluster.name"));
}
@ -93,32 +93,34 @@ public class InternalSettingsPreparerTests extends ESTestCase {
Path home = createTempDir();
Path config = home.resolve("config");
Files.createDirectory(config);
Files.copy(garbage, config.resolve("elasticsearch.yml"));
Files.copy(garbage, config.resolve("opensearch.yml"));
InternalSettingsPreparer.prepareEnvironment(Settings.builder().put(baseEnvSettings).build(),
emptyMap(), null, () -> "default_node_name");
} catch (SettingsException e) {
assertEquals("Failed to load settings from [elasticsearch.yml]", e.getMessage());
assertEquals("Failed to load settings from [opensearch.yml]", e.getMessage());
}
}
@AwaitsFix(bugUrl = "https://github.com/opensearch-project/OpenSearch/issues/358")
public void testYamlNotAllowed() throws IOException {
InputStream yaml = getClass().getResourceAsStream("/config/elasticsearch.yml");
InputStream yaml = getClass().getResourceAsStream("/config/opensearch.yml");
Path config = homeDir.resolve("config");
Files.createDirectory(config);
Files.copy(yaml, config.resolve("elasticsearch.yaml"));
Files.copy(yaml, config.resolve("opensearch.yaml"));
SettingsException e = expectThrows(SettingsException.class, () -> InternalSettingsPreparer.prepareEnvironment(
Settings.builder().put(baseEnvSettings).build(), emptyMap(), null, DEFAULT_NODE_NAME_SHOULDNT_BE_CALLED));
assertEquals("elasticsearch.yaml was deprecated in 5.5.0 and must be renamed to elasticsearch.yml", e.getMessage());
assertEquals("opensearch.yaml was deprecated in 5.5.0 and must be renamed to opensearch.yml", e.getMessage());
}
@AwaitsFix(bugUrl = "https://github.com/opensearch-project/OpenSearch/issues/358")
public void testJsonNotAllowed() throws IOException {
InputStream yaml = getClass().getResourceAsStream("/config/elasticsearch.json");
InputStream yaml = getClass().getResourceAsStream("/config/opensearch.json");
Path config = homeDir.resolve("config");
Files.createDirectory(config);
Files.copy(yaml, config.resolve("elasticsearch.json"));
Files.copy(yaml, config.resolve("opensearch.json"));
SettingsException e = expectThrows(SettingsException.class, () -> InternalSettingsPreparer.prepareEnvironment(
Settings.builder().put(baseEnvSettings).build(), emptyMap(), null, DEFAULT_NODE_NAME_SHOULDNT_BE_CALLED));
assertEquals("elasticsearch.json was deprecated in 5.5.0 and must be converted to elasticsearch.yml", e.getMessage());
assertEquals("opensearch.json was deprecated in 5.5.0 and must be converted to opensearch.yml", e.getMessage());
}
public void testSecureSettings() {