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

[Rename] server/test/resources #359

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
44 changes: 22 additions & 22 deletions server/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import org.elasticsearch.gradle.info.BuildParams
import org.opensearch.gradle.info.BuildParams

/*
* Licensed to Elasticsearch under one or more contributor
Expand All @@ -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) {
Expand Down Expand Up @@ -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}"
Expand All @@ -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
Expand All @@ -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'
}
}

Expand Down Expand Up @@ -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"
}
}
}
Expand Down Expand Up @@ -322,18 +322,18 @@ 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')
}
}

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'
}
Original file line number Diff line number Diff line change
Expand Up @@ -1202,7 +1202,7 @@ public void testNonSecureSettingInKeystore() {
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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
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;
Expand Down Expand Up @@ -82,7 +82,7 @@ public void testEmptySettings() {

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"));
}
Expand All @@ -93,32 +93,34 @@ public void testGarbageIsNotSwallowed() throws IOException {
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() {
Expand Down