Rename files under qa folder (#212)

* Rename directory elasticsearch to opensearch
Rename EvilElasticsearchCliTests EvilOpenSearchCliTests

Signed-off-by: Harold Wang <harowang@amazon.com>

* Rename org.elasticsearch to org.opensearch

Signed-off-by: Harold Wang <harowang@amazon.com>

* Rename waitForElasticsearch to waitForOpenSearch

Signed-off-by: Harold Wang <harowang@amazon.com>

* Rename OpensearchNode to OpenSearchNode

Signed-off-by: Harold Wang <harowang@amazon.com>

* Rename "elasticsearch.version" to "opensearch.version"

Signed-off-by: Harold Wang <harowang@amazon.com>

* Rename elasticsearchVersionString to opensearchVersionString

Signed-off-by: Harold Wang <harowang@amazon.com>

* Rename elasticsearch.yml to opensearch.yml

Signed-off-by: Harold Wang <harowang@amazon.com>

* Rename runElasticsearchTests to runOpenSearchTests

Signed-off-by: Harold Wang <harowang@amazon.com>

* Rename elasticsearchVersion to opensearchVersion

Signed-off-by: Harold Wang <harowang@amazon.com>

* Rename elasticsearch to opensearch in gradle files

Signed-off-by: Harold Wang <harowang@amazon.com>

* Rename ElasticsearchAssertions to OpenSearchAssertions

Signed-off-by: Harold Wang <harowang@amazon.com>

* Rename folder share/elasticsearch to share/opensearch

Signed-off-by: Harold Wang <harowang@amazon.com>

* Rename elasticsearch to opensearch

Signed-off-by: Harold Wang <harowang@amazon.com>

* Rename elasticsearch-service-x64 to opensearch-service-x64

Signed-off-by: Harold Wang <harowang@amazon.com>

* Rename elasticsearch-service.bat to opensearch-service.bat

Signed-off-by: Harold Wang <harowang@amazon.com>

* Rename Elasticsearch to Opensearch
Rename elasticsearch to opensearch

Signed-off-by: Harold Wang <harowang@amazon.com>

* Rename ELASTIC_PASSWORD_FILE to OPENSEARCH_PASSWORD_FILE

Signed-off-by: Harold Wang <harowang@amazon.com>

* Rename ELASTICSEARCH_PASSWORD to OPENSEARCH_PASSWORD
Rename elasticsearch to opensearch

Signed-off-by: Harold Wang <harowang@amazon.com>

* Rename elasticsearch to opensearch

Signed-off-by: Harold Wang <harowang@amazon.com>

* Rename elasticsearch.log to opensearch.log

Signed-off-by: Harold Wang <harowang@amazon.com>

* Rename es-repo to opensearch-repo

Signed-off-by: Harold Wang <harowang@amazon.com>

* Rename ESTestCase to OpenSearchTestCase

Signed-off-by: Harold Wang <harowang@amazon.com>

* Rename ESRestTestCase to OpenSearchRestTestCase

Signed-off-by: Harold Wang <harowang@amazon.com>

* Rename elasticsearch to opensearch
Rename "Starts ElasticSearch" to "Starts OpenSearch"

Signed-off-by: Harold Wang <harowang@amazon.com>

* Rename ESElasticsearchCliTestCase to BaseOpenSearchCliTestCase

Signed-off-by: Harold Wang <harowang@amazon.com>

* Rename "elasticsearch:test" to "opensearch:test"

Signed-off-by: Harold Wang <harowang@amazon.com>

* Rename test91ElasticsearchShardCliPackaging to test91OpenSearchShardCliPackaging

Signed-off-by: Harold Wang <harowang@amazon.com>

* Rename elasticsearch.toString to opensearch.toString

Signed-off-by: Harold Wang <harowang@amazon.com>

* Rename elasticsearch.pid to opensearch.pid

Signed-off-by: Harold Wang <harowang@amazon.com>

* Rename "Opensearch" to "OpenSearch"
Rename "elasticsearch" to "opensearch"

Signed-off-by: Harold Wang <harowang@amazon.com>

* Rename Elasticsearch to OpenSearch
Remove unecessary dot after opensearch.

Signed-off-by: Harold Wang <harowang@amazon.com>
This commit is contained in:
Harold Wang 2021-03-08 10:06:46 -08:00 committed by Nick Knize
parent cf46c398d9
commit a011c15bc8
155 changed files with 637 additions and 637 deletions

View File

@ -1,5 +1,5 @@
import org.elasticsearch.gradle.test.RestIntegTestTask
import org.elasticsearch.gradle.testclusters.TestClustersPlugin
import org.opensearch.gradle.test.RestIntegTestTask
import org.opensearch.gradle.testclusters.TestClustersPlugin
subprojects { Project subproj ->
subproj.tasks.withType(RestIntegTestTask) {

View File

@ -16,10 +16,10 @@
* specific language governing permissions and limitations
* under the License.
*/
apply plugin: 'elasticsearch.testclusters'
apply plugin: 'elasticsearch.standalone-rest-test'
apply plugin: 'elasticsearch.rest-test'
apply plugin: 'elasticsearch.test-with-dependencies'
apply plugin: 'opensearch.testclusters'
apply plugin: 'opensearch.standalone-rest-test'
apply plugin: 'opensearch.rest-test'
apply plugin: 'opensearch.test-with-dependencies'
dependencies {
testImplementation project(":client:rest-high-level")

View File

@ -54,7 +54,7 @@ import org.opensearch.common.xcontent.XContentBuilder;
import org.opensearch.common.xcontent.json.JsonXContent;
import org.opensearch.search.aggregations.InternalAggregations;
import org.opensearch.search.internal.InternalSearchResponse;
import org.opensearch.test.rest.ESRestTestCase;
import org.opensearch.test.rest.OpenSearchRestTestCase;
import org.opensearch.test.transport.MockTransportService;
import org.opensearch.threadpool.TestThreadPool;
import org.opensearch.threadpool.ThreadPool;
@ -71,7 +71,7 @@ import java.util.concurrent.TimeUnit;
import static org.hamcrest.CoreMatchers.containsString;
public class CrossClusterSearchUnavailableClusterIT extends ESRestTestCase {
public class CrossClusterSearchUnavailableClusterIT extends OpenSearchRestTestCase {
private static RestHighLevelClient restHighLevelClient;

View File

@ -1,12 +1,12 @@
import org.elasticsearch.gradle.info.BuildParams
import org.elasticsearch.gradle.util.GradleUtils
import org.opensearch.gradle.info.BuildParams
import org.opensearch.gradle.util.GradleUtils
apply plugin: 'elasticsearch.java-rest-test'
apply plugin: 'elasticsearch.esplugin'
apply plugin: 'opensearch.java-rest-test'
apply plugin: 'opensearch.esplugin'
esplugin {
description 'Die with dignity plugin'
classname 'org.elasticsearch.DieWithDignityPlugin'
classname 'org.opensearch.DieWithDignityPlugin'
}
// let the javaRestTest see the classpath of main

View File

@ -22,7 +22,7 @@ package org.opensearch.qa.die_with_dignity;
import org.opensearch.client.Request;
import org.opensearch.common.io.PathUtils;
import org.opensearch.common.settings.Settings;
import org.opensearch.test.rest.ESRestTestCase;
import org.opensearch.test.rest.OpenSearchRestTestCase;
import java.io.BufferedReader;
import java.io.IOException;
@ -36,14 +36,14 @@ import java.util.List;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.not;
public class DieWithDignityIT extends ESRestTestCase {
public class DieWithDignityIT extends OpenSearchRestTestCase {
public void testDieWithDignity() throws Exception {
expectThrows(
IOException.class,
() -> client().performRequest(new Request("GET", "/_die_with_dignity"))
);
// the Elasticsearch process should die and disappear from the output of jps
// the OpenSearch process should die and disappear from the output of jps
assertBusy(() -> {
final String jpsPath = PathUtils.get(System.getProperty("runtime.java.home"), "bin/jps").toString();
final Process process = new ProcessBuilder().command(jpsPath, "-v").start();
@ -57,7 +57,7 @@ public class DieWithDignityIT extends ESRestTestCase {
}
});
// parse the logs and ensure that Elasticsearch died with the expected cause
// parse the logs and ensure that OpenSearch died with the expected cause
final List<String> lines = Files.readAllLines(PathUtils.get(System.getProperty("log")));
final Iterator<String> it = lines.iterator();
@ -69,7 +69,7 @@ public class DieWithDignityIT extends ESRestTestCase {
final String line = it.next();
if (line.matches(".*ERROR.*o\\.e\\.ExceptionsHelper.*javaRestTest-0.*fatal error.*")) {
fatalError = true;
} else if (line.matches(".*ERROR.*o\\.e\\.b\\.ElasticsearchUncaughtExceptionHandler.*javaRestTest-0.*"
} else if (line.matches(".*ERROR.*o\\.e\\.b\\.OpenSearchUncaughtExceptionHandler.*javaRestTest-0.*"
+ "fatal error in thread \\[Thread-\\d+\\], exiting.*")) {
fatalErrorInThreadExiting = true;
assertTrue(it.hasNext());
@ -114,7 +114,7 @@ public class DieWithDignityIT extends ESRestTestCase {
// increase the timeout here to 90 seconds to handle long waits for a green
// cluster health. the waits for green need to be longer than a minute to
// account for delayed shards
.put(ESRestTestCase.CLIENT_SOCKET_TIMEOUT, "1s")
.put(OpenSearchRestTestCase.CLIENT_SOCKET_TIMEOUT, "1s")
.build();
}

View File

@ -23,8 +23,8 @@
* threads, etc.
*/
apply plugin: 'elasticsearch.testclusters'
apply plugin: 'elasticsearch.standalone-test'
apply plugin: 'opensearch.testclusters'
apply plugin: 'opensearch.standalone-test'
dependencies {
testImplementation 'com.google.jimfs:jimfs:1.1'

View File

@ -20,7 +20,7 @@
package org.opensearch.bootstrap;
import org.opensearch.common.SuppressForbidden;
import org.opensearch.test.ESTestCase;
import org.opensearch.test.OpenSearchTestCase;
import java.io.FilePermission;
import java.net.SocketPermission;
@ -37,7 +37,7 @@ import java.util.Collections;
* Unit tests for ESPolicy: these cannot run with security manager,
* we don't allow messing with the policy
*/
public class ESPolicyUnitTests extends ESTestCase {
public class ESPolicyUnitTests extends OpenSearchTestCase {
/**
* Test policy with null codesource.
* <p>
@ -86,11 +86,11 @@ public class ESPolicyUnitTests extends ESTestCase {
public void testDataPathPermissionIsChecked() {
assumeTrue("test cannot run with security manager", System.getSecurityManager() == null);
final PermissionCollection dataPathPermission = new Permissions();
dataPathPermission.add(new FilePermission("/home/elasticsearch/data/-", "read"));
dataPathPermission.add(new FilePermission("/home/opensearch/data/-", "read"));
final ESPolicy policy = new ESPolicy(Collections.emptyMap(), new Permissions(), Collections.emptyMap(), true, dataPathPermission);
assertTrue(
policy.implies(
new ProtectionDomain(new CodeSource(null, (Certificate[]) null), new Permissions()),
new FilePermission("/home/elasticsearch/data/index/file.si", "read")));
new FilePermission("/home/opensearch/data/index/file.si", "read")));
}
}

View File

@ -21,7 +21,7 @@ package org.opensearch.bootstrap;
import org.apache.lucene.util.Constants;
import org.opensearch.common.io.PathUtils;
import org.opensearch.test.ESTestCase;
import org.opensearch.test.OpenSearchTestCase;
import java.io.IOException;
import java.nio.file.Files;
@ -31,7 +31,7 @@ import static org.hamcrest.Matchers.anyOf;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
public class EvilJNANativesTests extends ESTestCase {
public class EvilJNANativesTests extends OpenSearchTestCase {
public void testSetMaximumNumberOfThreads() throws IOException {
if (Constants.LINUX) {

View File

@ -29,7 +29,7 @@ import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.Matchers.hasItem;
import static org.hamcrest.Matchers.hasSize;
public class EvilElasticsearchCliTests extends ESElasticsearchCliTestCase {
public class EvilOpenSearchCliTests extends BaseOpenSearchCliTestCase {
@SuppressForbidden(reason = "manipulates system properties for testing")
public void testPathHome() throws Exception {

View File

@ -25,7 +25,7 @@ import org.opensearch.common.io.PathUtils;
import org.opensearch.common.settings.Settings;
import org.opensearch.env.Environment;
import org.opensearch.env.TestEnvironment;
import org.opensearch.test.ESTestCase;
import org.opensearch.test.OpenSearchTestCase;
import java.io.FilePermission;
import java.io.IOException;
@ -39,7 +39,7 @@ import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.hasToString;
@SuppressForbidden(reason = "modifies system properties and attempts to create symbolic links intentionally")
public class EvilSecurityTests extends ESTestCase {
public class EvilSecurityTests extends OpenSearchTestCase {
/** test generated permissions */
public void testGeneratedPermissions() throws Exception {

View File

@ -20,10 +20,10 @@
package org.opensearch.bootstrap;
import org.apache.lucene.util.Constants;
import org.opensearch.test.ESTestCase;
import org.opensearch.test.OpenSearchTestCase;
/** Simple tests system call filter is working. */
public class SystemCallFilterTests extends ESTestCase {
public class SystemCallFilterTests extends OpenSearchTestCase {
/** command to try to run in tests */
static final String EXECUTABLE = Constants.WINDOWS ? "calc" : "ls";

View File

@ -20,7 +20,7 @@
package org.opensearch.cli;
import joptsimple.OptionSet;
import org.opensearch.test.ESTestCase;
import org.opensearch.test.OpenSearchTestCase;
import java.io.IOException;
import java.util.concurrent.atomic.AtomicBoolean;
@ -29,7 +29,7 @@ import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.Matchers.emptyString;
import static org.hamcrest.Matchers.is;
public class EvilCommandTests extends ESTestCase {
public class EvilCommandTests extends OpenSearchTestCase {
public void testCommandShutdownHook() throws Exception {
final AtomicBoolean closed = new AtomicBoolean();

View File

@ -23,14 +23,14 @@ import joptsimple.OptionSet;
import org.apache.lucene.util.TestRuleRestoreSystemProperties;
import org.opensearch.common.SuppressForbidden;
import org.opensearch.env.Environment;
import org.opensearch.test.ESTestCase;
import org.opensearch.test.OpenSearchTestCase;
import org.junit.Rule;
import org.junit.rules.TestRule;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.hasToString;
public class EvilEnvironmentAwareCommandTests extends ESTestCase {
public class EvilEnvironmentAwareCommandTests extends OpenSearchTestCase {
@Rule
public TestRule restoreSystemProperties = new TestRuleRestoreSystemProperties("es.path.conf");

View File

@ -20,9 +20,9 @@ package org.opensearch.cluster.metadata;
import org.opensearch.common.SuppressForbidden;
import org.opensearch.common.settings.Settings;
import org.opensearch.test.ESTestCase;
import org.opensearch.test.OpenSearchTestCase;
public class EvilSystemPropertyTests extends ESTestCase {
public class EvilSystemPropertyTests extends OpenSearchTestCase {
@SuppressForbidden(reason = "manipulates system properties for testing")
public void testMaxNumShards() {

View File

@ -21,11 +21,11 @@ package org.opensearch.cluster.routing;
import org.opensearch.common.SuppressForbidden;
import org.opensearch.common.settings.ClusterSettings;
import org.opensearch.common.settings.Settings;
import org.opensearch.test.ESTestCase;
import org.opensearch.test.OpenSearchTestCase;
import static org.hamcrest.Matchers.equalTo;
public class EvilSystemPropertyTests extends ESTestCase {
public class EvilSystemPropertyTests extends OpenSearchTestCase {
@SuppressForbidden(reason = "manipulates system properties for testing")
public void testDisableSearchAllocationAwareness() {

View File

@ -30,7 +30,7 @@ import org.apache.logging.log4j.core.config.LoggerConfig;
import org.opensearch.cli.UserException;
import org.opensearch.common.settings.Settings;
import org.opensearch.env.Environment;
import org.opensearch.test.ESTestCase;
import org.opensearch.test.OpenSearchTestCase;
import java.io.IOException;
import java.nio.file.Path;
@ -42,7 +42,7 @@ import static org.hamcrest.Matchers.hasKey;
import static org.hamcrest.Matchers.hasToString;
import static org.hamcrest.Matchers.notNullValue;
public class EvilLoggerConfigurationTests extends ESTestCase {
public class EvilLoggerConfigurationTests extends OpenSearchTestCase {
@Override
public void setUp() throws Exception {

View File

@ -38,7 +38,7 @@ import org.opensearch.common.settings.Settings;
import org.opensearch.common.util.concurrent.ThreadContext;
import org.opensearch.env.Environment;
import org.opensearch.node.Node;
import org.opensearch.test.ESTestCase;
import org.opensearch.test.OpenSearchTestCase;
import org.opensearch.test.hamcrest.RegexMatcher;
import java.io.IOException;
@ -64,7 +64,7 @@ import static org.hamcrest.Matchers.hasItem;
import static org.hamcrest.Matchers.lessThan;
import static org.hamcrest.Matchers.startsWith;
public class EvilLoggerTests extends ESTestCase {
public class EvilLoggerTests extends OpenSearchTestCase {
@Override
public void setUp() throws Exception {
@ -211,7 +211,7 @@ public class EvilLoggerTests extends ESTestCase {
deprecationEvents.get(0),
DEPRECATION,
"org.opensearch.common.logging.DeprecationLogger\\$DeprecationLoggerBuilder.withDeprecation",
"\\[deprecated.foo\\] setting was deprecated in Elasticsearch and will be removed in a future release! " +
"\\[deprecated.foo\\] setting was deprecated in OpenSearch and will be removed in a future release! " +
"See the breaking changes documentation for the next major version.");
}
}

View File

@ -23,7 +23,7 @@ import org.apache.lucene.util.Constants;
import org.apache.lucene.util.LuceneTestCase;
import org.opensearch.cli.ExitCodes;
import org.opensearch.cli.UserException;
import org.opensearch.test.ESTestCase;
import org.opensearch.test.OpenSearchTestCase;
import java.nio.file.AccessDeniedException;
import java.nio.file.Files;
@ -38,7 +38,7 @@ import static org.hamcrest.Matchers.hasToString;
import static org.hamcrest.Matchers.instanceOf;
@LuceneTestCase.SuppressFileSystems("ExtrasFS")
public class EvilKeyStoreWrapperTests extends ESTestCase {
public class EvilKeyStoreWrapperTests extends OpenSearchTestCase {
public void testWritePermissions() throws Exception {
assumeFalse("requires POSIX file permissions", Constants.WINDOWS);
@ -53,8 +53,8 @@ public class EvilKeyStoreWrapperTests extends ESTestCase {
final UserException e = expectThrows(UserException.class, () -> wrapper.save(configDir, new char[0]));
final String expected = String.format(
Locale.ROOT,
"unable to create temporary keystore at [%s], write permissions required for [%s] or run [elasticsearch-keystore upgrade]",
configDir.resolve("elasticsearch.keystore.tmp"),
"unable to create temporary keystore at [%s], write permissions required for [%s] or run [opensearch-keystore upgrade]",
configDir.resolve("opensearch.keystore.tmp"),
configDir);
assertThat(e, hasToString(containsString(expected)));
assertThat(e.exitCode, equalTo(ExitCodes.CONFIG));

View File

@ -20,7 +20,7 @@ package org.opensearch.env;
import org.opensearch.common.io.PathUtils;
import org.opensearch.common.settings.Settings;
import org.opensearch.test.ESTestCase;
import org.opensearch.test.OpenSearchTestCase;
import org.opensearch.test.PosixPermissionsResetter;
import org.junit.BeforeClass;
@ -32,7 +32,7 @@ import java.nio.file.attribute.PosixFilePermission;
import java.util.Arrays;
import java.util.HashSet;
public class NodeEnvironmentEvilTests extends ESTestCase {
public class NodeEnvironmentEvilTests extends OpenSearchTestCase {
private static boolean isPosix;

View File

@ -21,7 +21,7 @@ package org.opensearch.monitor.os;
import org.apache.lucene.util.Constants;
import org.opensearch.common.io.PathUtils;
import org.opensearch.test.ESTestCase;
import org.opensearch.test.OpenSearchTestCase;
import java.io.IOException;
import java.nio.file.Files;
@ -32,7 +32,7 @@ import java.util.regex.Pattern;
import static org.hamcrest.Matchers.equalTo;
public class EvilOsProbeTests extends ESTestCase {
public class EvilOsProbeTests extends OpenSearchTestCase {
public void testOsPrettyName() throws IOException {
final OsInfo osInfo = OsProbe.getInstance().osInfo(randomLongBetween(1, 100), randomIntBetween(1, 8));

View File

@ -19,7 +19,7 @@
package org.opensearch.plugins;
import org.opensearch.test.ESTestCase;
import org.opensearch.test.OpenSearchTestCase;
import java.nio.file.Path;
import java.util.Set;
@ -28,7 +28,7 @@ import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.containsInAnyOrder;
/** Tests plugin manager security check */
public class PluginSecurityTests extends ESTestCase {
public class PluginSecurityTests extends OpenSearchTestCase {
/** Test that we can parse the set of permissions correctly for a simple policy */
public void testParsePermissions() throws Exception {

View File

@ -25,7 +25,7 @@ import org.opensearch.common.util.concurrent.AbstractRunnable;
import org.opensearch.common.util.concurrent.EsExecutors;
import org.opensearch.common.util.concurrent.EsThreadPoolExecutor;
import org.opensearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor;
import org.opensearch.test.ESTestCase;
import org.opensearch.test.OpenSearchTestCase;
import org.junit.After;
import org.junit.Before;
@ -41,7 +41,7 @@ import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.hasToString;
import static org.hamcrest.Matchers.instanceOf;
public class EvilThreadPoolTests extends ESTestCase {
public class EvilThreadPoolTests extends OpenSearchTestCase {
private ThreadPool threadPool;

View File

@ -23,7 +23,7 @@ appender.deprecation_file.filter.rate_limit.type = RateLimitingFilter
appender.header_warning.type = HeaderWarningAppender
appender.header_warning.name = header_warning
logger.deprecation.name = org.elasticsearch.deprecation.common.settings
logger.deprecation.name = org.opensearch.deprecation.common.settings
logger.deprecation.level = deprecation
logger.deprecation.appenderRef.deprecation_console.ref = console
logger.deprecation.appenderRef.deprecation_file.ref = deprecation_file

View File

@ -18,12 +18,12 @@
*/
import org.elasticsearch.gradle.Version
import org.elasticsearch.gradle.info.BuildParams
import org.elasticsearch.gradle.testclusters.StandaloneRestIntegTestTask
import org.opensearch.gradle.Version
import org.opensearch.gradle.info.BuildParams
import org.opensearch.gradle.testclusters.StandaloneRestIntegTestTask
apply plugin: 'elasticsearch.testclusters'
apply plugin: 'elasticsearch.standalone-test'
apply plugin: 'opensearch.testclusters'
apply plugin: 'opensearch.standalone-test'
apply from : "$rootDir/gradle/bwc-test.gradle"
for (Version bwcVersion : BuildParams.bwcVersions.indexCompatible) {

View File

@ -43,7 +43,7 @@ import org.opensearch.rest.action.document.RestUpdateAction;
import org.opensearch.rest.action.search.RestExplainAction;
import org.opensearch.test.NotEqualMessageBuilder;
import org.opensearch.test.XContentTestUtils;
import org.opensearch.test.rest.ESRestTestCase;
import org.opensearch.test.rest.OpenSearchRestTestCase;
import org.opensearch.test.rest.yaml.ObjectPath;
import org.junit.Before;
@ -1311,7 +1311,7 @@ public class FullClusterRestartIT extends AbstractFullClusterRestartTestCase {
/**
* Wait for an index to have green health, waiting longer than
* {@link ESRestTestCase#ensureGreen}.
* {@link OpenSearchRestTestCase#ensureGreen}.
*/
protected void ensureGreenLongWait(String index) throws IOException {
Request request = new Request("GET", "/_cluster/health/" + index);

View File

@ -17,14 +17,14 @@
* under the License.
*/
apply plugin: 'elasticsearch.testclusters'
apply plugin: 'elasticsearch.standalone-rest-test'
apply plugin: 'elasticsearch.rest-test'
apply plugin: 'elasticsearch.standalone-test'
apply plugin: 'opensearch.testclusters'
apply plugin: 'opensearch.standalone-rest-test'
apply plugin: 'opensearch.rest-test'
apply plugin: 'opensearch.standalone-test'
testClusters.integTest {
/**
* Provide a custom log4j configuration where layout is an old style pattern and confirm that Elasticsearch
* Provide a custom log4j configuration where layout is an old style pattern and confirm that OpenSearch
* can successfully startup.
*/
extraConfigFile 'log4j2.properties', file('custom-log4j2.properties')

View File

@ -2,7 +2,7 @@
status = error
# log action execution errors for easier debugging
logger.action.name = org.elasticsearch.action
logger.action.name = org.opensearch.action
logger.action.level = debug
appender.rolling.type = RollingFile

View File

@ -19,12 +19,12 @@
package org.opensearch.common.logging;
import org.opensearch.test.ESTestCase;
import org.opensearch.test.OpenSearchTestCase;
import org.hamcrest.Matchers;
import org.junit.BeforeClass;
public class ESJsonLayoutTests extends ESTestCase {
public class ESJsonLayoutTests extends OpenSearchTestCase {
@BeforeClass
public static void initNodeName() {
JsonLogsTestSetup.init();

View File

@ -32,7 +32,7 @@ import org.opensearch.common.util.concurrent.ThreadContext;
import org.opensearch.env.Environment;
import org.opensearch.index.shard.ShardId;
import org.opensearch.tasks.Task;
import org.opensearch.test.ESTestCase;
import org.opensearch.test.OpenSearchTestCase;
import org.hamcrest.FeatureMatcher;
import org.hamcrest.Matcher;
import org.hamcrest.Matchers;
@ -56,7 +56,7 @@ import static org.hamcrest.Matchers.not;
* This test confirms JSON log structure is properly formatted and can be parsed.
* It has to be in a <code>org.opensearch.common.logging</code> package to use <code>PrefixLogger</code>
*/
public class JsonLoggerTests extends ESTestCase {
public class JsonLoggerTests extends OpenSearchTestCase {
private static final String LINE_SEPARATOR = System.lineSeparator();
@ -100,7 +100,7 @@ public class JsonLoggerTests extends ESTestCase {
hasEntry("type", "deprecation"),
hasEntry("level", "DEPRECATION"),
hasEntry("component", "d.test"),
hasEntry("cluster.name", "elasticsearch"),
hasEntry("cluster.name", "opensearch"),
hasEntry("node.name", "sample-name"),
hasEntry("message", "deprecated message1"),
hasEntry("x-opaque-id", "someId")
@ -133,7 +133,7 @@ public class JsonLoggerTests extends ESTestCase {
hasEntry("type", "deprecation"),
hasEntry("level", "INFO"),
hasEntry("component", "test"),
hasEntry("cluster.name", "elasticsearch"),
hasEntry("cluster.name", "opensearch"),
hasEntry("node.name", "sample-name"),
hasEntry("message", "deprecated message1"),
hasEntry("x-opaque-id", "someId")),
@ -141,7 +141,7 @@ public class JsonLoggerTests extends ESTestCase {
hasEntry("type", "deprecation"),
hasEntry("level", "INFO"),
hasEntry("component", "test"),
hasEntry("cluster.name", "elasticsearch"),
hasEntry("cluster.name", "opensearch"),
hasEntry("node.name", "sample-name"),
hasEntry("message", "deprecated message2"),
not(hasKey("x-opaque-id"))
@ -150,7 +150,7 @@ public class JsonLoggerTests extends ESTestCase {
hasEntry("type", "deprecation"),
hasEntry("level", "INFO"),
hasEntry("component", "test"),
hasEntry("cluster.name", "elasticsearch"),
hasEntry("cluster.name", "opensearch"),
hasEntry("node.name", "sample-name"),
hasEntry("message", "deprecated message4"),
not(hasKey("x-opaque-id"))
@ -294,7 +294,7 @@ public class JsonLoggerTests extends ESTestCase {
hasEntry("type", "deprecation"),
hasEntry("level", "DEPRECATION"),
hasEntry("component", "d.test"),
hasEntry("cluster.name", "elasticsearch"),
hasEntry("cluster.name", "opensearch"),
hasEntry("node.name", "sample-name"),
hasEntry("message", "message1"),
hasEntry("x-opaque-id", "ID1"))
@ -325,7 +325,7 @@ public class JsonLoggerTests extends ESTestCase {
hasEntry("type", "deprecation"),
hasEntry("level", "DEPRECATION"),
hasEntry("component", "d.test"),
hasEntry("cluster.name", "elasticsearch"),
hasEntry("cluster.name", "opensearch"),
hasEntry("node.name", "sample-name"),
hasEntry("message", "message1"),
hasEntry("x-opaque-id", "ID1")
@ -334,7 +334,7 @@ public class JsonLoggerTests extends ESTestCase {
hasEntry("type", "deprecation"),
hasEntry("level", "DEPRECATION"),
hasEntry("component", "d.test"),
hasEntry("cluster.name", "elasticsearch"),
hasEntry("cluster.name", "opensearch"),
hasEntry("node.name", "sample-name"),
hasEntry("message", "message1"),
hasEntry("x-opaque-id", "ID2")

View File

@ -21,7 +21,7 @@ package org.opensearch.qa.custom_logging;
import org.opensearch.common.SuppressForbidden;
import org.opensearch.test.hamcrest.RegexMatcher;
import org.opensearch.test.rest.ESRestTestCase;
import org.opensearch.test.rest.OpenSearchRestTestCase;
import org.hamcrest.Matchers;
import java.io.IOException;
@ -35,11 +35,11 @@ import java.security.PrivilegedAction;
import java.util.List;
/**
* This test verifies that Elasticsearch can startup successfully with a custom logging config using variables introduced in
* This test verifies that OpenSearch can startup successfully with a custom logging config using variables introduced in
* <code>ESJsonLayout</code>
* The intention is to confirm that users can still run their Elasticsearch instances with previous configurations.
* The intention is to confirm that users can still run their OpenSearch instances with previous configurations.
*/
public class CustomLoggingConfigIT extends ESRestTestCase {
public class CustomLoggingConfigIT extends OpenSearchRestTestCase {
private static final String NODE_STARTED = ".*integTest-0.*cluster.uuid.*node.id.*recovered.*cluster_state.*";
public void testSuccessfulStartupWithCustomConfig() throws Exception {

View File

@ -17,15 +17,15 @@
* under the License.
*/
import org.elasticsearch.gradle.Version
import org.elasticsearch.gradle.VersionProperties
import org.elasticsearch.gradle.info.BuildParams
import org.elasticsearch.gradle.testclusters.StandaloneRestIntegTestTask
import org.opensearch.gradle.Version
import org.opensearch.gradle.VersionProperties
import org.opensearch.gradle.info.BuildParams
import org.opensearch.gradle.testclusters.StandaloneRestIntegTestTask
apply plugin: 'elasticsearch.testclusters'
apply plugin: 'elasticsearch.standalone-test'
apply plugin: 'opensearch.testclusters'
apply plugin: 'opensearch.standalone-test'
apply from : "$rootDir/gradle/bwc-test.gradle"
apply plugin: 'elasticsearch.rest-resources'
apply plugin: 'opensearch.rest-resources'
restResources {
restTests {
@ -34,7 +34,7 @@ restResources {
}
for (Version bwcVersion : BuildParams.bwcVersions.wireCompatible) {
if (bwcVersion == VersionProperties.getElasticsearchVersion()) {
if (bwcVersion == VersionProperties.getOpenSearchVersion()) {
// Not really a mixed cluster
continue;
}

View File

@ -30,7 +30,7 @@ import org.opensearch.common.xcontent.json.JsonXContent;
import org.opensearch.index.seqno.SeqNoStats;
import org.opensearch.rest.action.document.RestGetAction;
import org.opensearch.rest.action.document.RestIndexAction;
import org.opensearch.test.rest.ESRestTestCase;
import org.opensearch.test.rest.OpenSearchRestTestCase;
import org.opensearch.test.rest.yaml.ObjectPath;
import java.io.IOException;
@ -42,7 +42,7 @@ import java.util.stream.Collectors;
import static org.hamcrest.Matchers.equalTo;
public class IndexingIT extends ESRestTestCase {
public class IndexingIT extends OpenSearchRestTestCase {
private int indexDocs(String index, final int idStart, final int numDocs) throws IOException {
for (int i = 0; i < numDocs; i++) {

View File

@ -17,11 +17,11 @@
* under the License.
*/
import org.elasticsearch.gradle.test.RestIntegTestTask
import org.opensearch.gradle.test.RestIntegTestTask
apply plugin: 'elasticsearch.testclusters'
apply plugin: 'elasticsearch.standalone-test'
apply plugin: 'elasticsearch.rest-resources'
apply plugin: 'opensearch.testclusters'
apply plugin: 'opensearch.standalone-test'
apply plugin: 'opensearch.rest-resources'
dependencies {
testImplementation project(":client:rest-high-level")

View File

@ -85,7 +85,7 @@ import org.opensearch.search.suggest.phrase.PhraseSuggestionBuilder;
import org.opensearch.search.suggest.term.TermSuggestion;
import org.opensearch.search.suggest.term.TermSuggestionBuilder;
import org.opensearch.test.NotEqualMessageBuilder;
import org.opensearch.test.rest.ESRestTestCase;
import org.opensearch.test.rest.OpenSearchRestTestCase;
import org.junit.AfterClass;
import org.junit.Before;
@ -120,7 +120,7 @@ import static org.hamcrest.Matchers.greaterThanOrEqualTo;
* such parameter, hence we want to verify that results are the same in both scenarios.
*/
@TimeoutSuite(millis = 5 * TimeUnits.MINUTE) // to account for slow as hell VMs
public class CCSDuelIT extends ESRestTestCase {
public class CCSDuelIT extends OpenSearchRestTestCase {
private static final String INDEX_NAME = "ccs_duel_index";
private static final String REMOTE_INDEX_NAME = "my_remote_cluster:" + INDEX_NAME;

View File

@ -22,4 +22,4 @@
* example to test process spawning.
*/
apply plugin: 'elasticsearch.standalone-test'
apply plugin: 'opensearch.standalone-test'

View File

@ -53,9 +53,9 @@ import static org.hamcrest.Matchers.instanceOf;
/**
* Create a simple "daemon controller", put it in the right place and check that it runs.
*
* Extends LuceneTestCase rather than ESTestCase as ESTestCase installs a system call filter, and
* Extends LuceneTestCase rather than OpenSearchTestCase as OpenSearchTestCase installs a system call filter, and
* that prevents the Spawner class from doing its job. Also needs to run in a separate JVM to other
* tests that extend ESTestCase for the same reason.
* tests that extend OpenSearchTestCase for the same reason.
*/
public class SpawnerNoBootstrapTests extends LuceneTestCase {
@ -84,7 +84,7 @@ public class SpawnerNoBootstrapTests extends LuceneTestCase {
plugin,
"description", "a_plugin",
"version", Version.CURRENT.toString(),
"elasticsearch.version", Version.CURRENT.toString(),
"opensearch.version", Version.CURRENT.toString(),
"name", "a_plugin",
"java.version", "1.8",
"classname", "APlugin",
@ -127,7 +127,7 @@ public class SpawnerNoBootstrapTests extends LuceneTestCase {
plugin,
"description", "test_plugin",
"version", Version.CURRENT.toString(),
"elasticsearch.version", Version.CURRENT.toString(),
"opensearch.version", Version.CURRENT.toString(),
"name", "test_plugin",
"java.version", "1.8",
"classname", "TestPlugin",
@ -142,7 +142,7 @@ public class SpawnerNoBootstrapTests extends LuceneTestCase {
otherPlugin,
"description", "other_plugin",
"version", Version.CURRENT.toString(),
"elasticsearch.version", Version.CURRENT.toString(),
"opensearch.version", Version.CURRENT.toString(),
"name", "other_plugin",
"java.version", "1.8",
"classname", "OtherPlugin",
@ -185,7 +185,7 @@ public class SpawnerNoBootstrapTests extends LuceneTestCase {
plugin,
"description", "test_plugin",
"version", Version.CURRENT.toString(),
"elasticsearch.version", Version.CURRENT.toString(),
"opensearch.version", Version.CURRENT.toString(),
"name", "test_plugin",
"java.version", "1.8",
"classname", "TestPlugin",

View File

@ -80,7 +80,7 @@ public class ArchiveTests extends PackagingTestCase {
mv(installation.bundledJdk, relocatedJdk);
}
// ask for elasticsearch version to quickly exit if java is actually found (ie test failure)
final Result runResult = sh.runIgnoreExitCode(bin.elasticsearch.toString() + " -v");
final Result runResult = sh.runIgnoreExitCode(bin.opensearch.toString() + " -v");
assertThat(runResult.exitCode, is(1));
assertThat(runResult.stderr, containsString("could not find java in bundled jdk"));
} finally {
@ -95,7 +95,7 @@ public class ArchiveTests extends PackagingTestCase {
sh.getEnv().put("JAVA_HOME", "doesnotexist");
// ask for elasticsearch version to quickly exit if java is actually found (ie test failure)
final Result runResult = sh.runIgnoreExitCode(bin.elasticsearch.toString() + " -V");
final Result runResult = sh.runIgnoreExitCode(bin.opensearch.toString() + " -V");
assertThat(runResult.exitCode, is(1));
assertThat(runResult.stderr, containsString("could not find java in JAVA_HOME"));
@ -111,7 +111,7 @@ public class ArchiveTests extends PackagingTestCase {
try {
mv(installation.bundledJdk, relocatedJdk);
// ask for elasticsearch version to avoid starting the app
final Result runResult = sh.run(bin.elasticsearch.toString() + " -V");
final Result runResult = sh.run(bin.opensearch.toString() + " -V");
assertThat(runResult.stdout, startsWith("Version: "));
} finally {
mv(relocatedJdk, installation.bundledJdk);
@ -120,14 +120,14 @@ public class ArchiveTests extends PackagingTestCase {
public void test50StartAndStop() throws Exception {
// cleanup from previous test
rm(installation.config("elasticsearch.keystore"));
rm(installation.config("opensearch.keystore"));
try {
startElasticsearch();
startOpenSearch();
} catch (Exception e) {
if (Files.exists(installation.home.resolve("elasticsearch.pid"))) {
String pid = FileUtils.slurp(installation.home.resolve("elasticsearch.pid")).trim();
logger.info("Dumping jstack of elasticsearch processb ({}) that failed to start", pid);
if (Files.exists(installation.home.resolve("opensearch.pid"))) {
String pid = FileUtils.slurp(installation.home.resolve("opensearch.pid")).trim();
logger.info("Dumping jstack of opensearch processb ({}) that failed to start", pid);
sh.runIgnoreExitCode("jstack " + pid);
}
throw e;
@ -135,9 +135,9 @@ public class ArchiveTests extends PackagingTestCase {
List<Path> gcLogs = FileUtils.lsGlob(installation.logs, "gc.log*");
assertThat(gcLogs, is(not(empty())));
ServerUtils.runElasticsearchTests();
ServerUtils.runOpenSearchTests();
stopElasticsearch();
stopOpenSearch();
}
public void test51JavaHomeOverride() throws Exception {
@ -150,12 +150,12 @@ public class ArchiveTests extends PackagingTestCase {
sh.getEnv().put("JAVA_HOME", systemJavaHome1);
});
startElasticsearch();
ServerUtils.runElasticsearchTests();
stopElasticsearch();
startOpenSearch();
ServerUtils.runOpenSearchTests();
stopOpenSearch();
String systemJavaHome1 = sh.getEnv().get("JAVA_HOME");
assertThat(FileUtils.slurpAllLogs(installation.logs, "elasticsearch.log", "*.log.gz"), containsString(systemJavaHome1));
assertThat(FileUtils.slurpAllLogs(installation.logs, "opensearch.log", "*.log.gz"), containsString(systemJavaHome1));
}
public void test52BundledJdkRemoved() throws Exception {
@ -173,12 +173,12 @@ public class ArchiveTests extends PackagingTestCase {
sh.getEnv().put("JAVA_HOME", systemJavaHome1);
});
startElasticsearch();
ServerUtils.runElasticsearchTests();
stopElasticsearch();
startOpenSearch();
ServerUtils.runOpenSearchTests();
stopOpenSearch();
String systemJavaHome1 = sh.getEnv().get("JAVA_HOME");
assertThat(FileUtils.slurpAllLogs(installation.logs, "elasticsearch.log", "*.log.gz"), containsString(systemJavaHome1));
assertThat(FileUtils.slurpAllLogs(installation.logs, "opensearch.log", "*.log.gz"), containsString(systemJavaHome1));
} finally {
mv(relocatedJdk, installation.bundledJdk);
}
@ -194,11 +194,11 @@ public class ArchiveTests extends PackagingTestCase {
sh.getEnv().put("JAVA_HOME", "C:\\Program Files (x86)\\java");
// verify ES can start, stop and run plugin list
startElasticsearch();
startOpenSearch();
stopElasticsearch();
stopOpenSearch();
String pluginListCommand = installation.bin + "/elasticsearch-plugin list";
String pluginListCommand = installation.bin + "/opensearch-plugin list";
Result result = sh.run(pluginListCommand);
assertThat(result.exitCode, equalTo(0));
@ -219,11 +219,11 @@ public class ArchiveTests extends PackagingTestCase {
sh.getEnv().put("JAVA_HOME", testJavaHome);
// verify ES can start, stop and run plugin list
startElasticsearch();
startOpenSearch();
stopElasticsearch();
stopOpenSearch();
String pluginListCommand = installation.bin + "/elasticsearch-plugin list";
String pluginListCommand = installation.bin + "/opensearch-plugin list";
Result result = sh.run(pluginListCommand);
assertThat(result.exitCode, equalTo(0));
} finally {
@ -235,13 +235,13 @@ public class ArchiveTests extends PackagingTestCase {
public void test54ForceBundledJdkEmptyJavaHome() throws Exception {
assumeThat(distribution().hasJdk, is(true));
// cleanup from previous test
rm(installation.config("elasticsearch.keystore"));
rm(installation.config("opensearch.keystore"));
sh.getEnv().put("JAVA_HOME", "");
startElasticsearch();
ServerUtils.runElasticsearchTests();
stopElasticsearch();
startOpenSearch();
ServerUtils.runOpenSearchTests();
stopOpenSearch();
}
public void test70CustomPathConfAndJvmOptions() throws Exception {
@ -252,13 +252,13 @@ public class ArchiveTests extends PackagingTestCase {
sh.getEnv().put("ES_JAVA_OPTS", "-XX:-UseCompressedOops");
startElasticsearch();
startOpenSearch();
final String nodesResponse = makeRequest(Request.Get("http://localhost:9200/_nodes"));
assertThat(nodesResponse, containsString("\"heap_init_in_bytes\":536870912"));
assertThat(nodesResponse, containsString("\"using_compressed_ordinary_object_pointers\":\"false\""));
stopElasticsearch();
stopOpenSearch();
});
}
@ -267,12 +267,12 @@ public class ArchiveTests extends PackagingTestCase {
try {
append(heapOptions, "-Xms512m\n-Xmx512m\n");
startElasticsearch();
startOpenSearch();
final String nodesResponse = makeRequest(Request.Get("http://localhost:9200/_nodes"));
assertThat(nodesResponse, containsString("\"heap_init_in_bytes\":536870912"));
stopElasticsearch();
stopOpenSearch();
} finally {
rm(heapOptions);
}
@ -289,13 +289,13 @@ public class ArchiveTests extends PackagingTestCase {
append(firstOptions, "-Xms384m\n-Xmx384m\n-XX:-UseCompressedOops\n");
append(secondOptions, "-Xms512m\n-Xmx512m\n");
startElasticsearch();
startOpenSearch();
final String nodesResponse = makeRequest(Request.Get("http://localhost:9200/_nodes"));
assertThat(nodesResponse, containsString("\"heap_init_in_bytes\":536870912"));
assertThat(nodesResponse, containsString("\"using_compressed_ordinary_object_pointers\":\"false\""));
stopElasticsearch();
stopOpenSearch();
} finally {
rm(firstOptions);
rm(secondOptions);
@ -307,12 +307,12 @@ public class ArchiveTests extends PackagingTestCase {
try {
append(jvmOptionsIgnored, "-Xms512\n-Xmx512m\n");
startElasticsearch();
startOpenSearch();
final String nodesResponse = makeRequest(Request.Get("http://localhost:9200/_nodes"));
assertThat(nodesResponse, containsString("\"heap_init_in_bytes\":1073741824"));
stopElasticsearch();
stopOpenSearch();
} finally {
rm(jvmOptionsIgnored);
}
@ -321,18 +321,18 @@ public class ArchiveTests extends PackagingTestCase {
public void test80RelativePathConf() throws Exception {
withCustomConfig(tempConf -> {
append(tempConf.resolve("elasticsearch.yml"), "node.name: relative");
append(tempConf.resolve("opensearch.yml"), "node.name: relative");
startElasticsearch();
startOpenSearch();
final String nodesResponse = makeRequest(Request.Get("http://localhost:9200/_nodes"));
assertThat(nodesResponse, containsString("\"name\":\"relative\""));
stopElasticsearch();
stopOpenSearch();
});
}
public void test91ElasticsearchShardCliPackaging() throws Exception {
public void test91OpenSearchShardCliPackaging() throws Exception {
final Installation.Executables bin = installation.executables();
Platforms.PlatformAction action = () -> {
@ -341,7 +341,7 @@ public class ArchiveTests extends PackagingTestCase {
};
}
public void test92OpensearchNodeCliPackaging() throws Exception {
public void test92OpenSearchNodeCliPackaging() throws Exception {
final Installation.Executables bin = installation.executables();
Platforms.PlatformAction action = () -> {
@ -350,14 +350,14 @@ public class ArchiveTests extends PackagingTestCase {
};
}
public void test93OpensearchNodeCustomDataPathAndNotEsHomeWorkDir() throws Exception {
public void test93OpenSearchNodeCustomDataPathAndNotEsHomeWorkDir() throws Exception {
Path relativeDataPath = installation.data.relativize(installation.home);
append(installation.config("elasticsearch.yml"), "path.data: " + relativeDataPath);
append(installation.config("opensearch.yml"), "path.data: " + relativeDataPath);
sh.setWorkingDirectory(getRootTempDir());
startElasticsearch();
stopElasticsearch();
startOpenSearch();
stopOpenSearch();
Result result = sh.run("echo y | " + installation.executables().nodeTool + " unsafe-bootstrap");
assertThat(result.stdout, containsString("Master node was successfully bootstrapped"));

View File

@ -44,7 +44,7 @@ public class ConfigurationTests extends PackagingTestCase {
String hostnameKey = Platforms.WINDOWS ? "COMPUTERNAME" : "HOSTNAME";
sh.getEnv().put(hostnameKey, "mytesthost");
withCustomConfig(confPath -> {
FileUtils.append(confPath.resolve("elasticsearch.yml"), "node.name: ${HOSTNAME}");
FileUtils.append(confPath.resolve("opensearch.yml"), "node.name: ${HOSTNAME}");
if (distribution.isPackage()) {
append(installation.envFile, "HOSTNAME=mytesthost");
}

View File

@ -59,7 +59,7 @@ public class DebPreservationTests extends PackagingTestCase {
// some config files were not removed
assertPathsExist(
installation.config,
installation.config("elasticsearch.yml"),
installation.config("opensearch.yml"),
installation.config("jvm.options"),
installation.config("log4j2.properties"),
installation.config(Paths.get("jvm.options.d", "heap.options"))
@ -67,7 +67,7 @@ public class DebPreservationTests extends PackagingTestCase {
// keystore was removed
assertPathsDoNotExist(installation.config("elasticsearch.keystore"), installation.config(".elasticsearch.keystore.initial_md5sum"));
assertPathsDoNotExist(installation.config("opensearch.keystore"), installation.config(".opensearch.keystore.initial_md5sum"));
// sysvinit service file was not removed
assertThat(SYSVINIT_SCRIPT, fileExists());

View File

@ -53,7 +53,7 @@ import static org.opensearch.packaging.util.Docker.rmDirWithPrivilegeEscalation;
import static org.opensearch.packaging.util.Docker.runContainer;
import static org.opensearch.packaging.util.Docker.runContainerExpectingFailure;
import static org.opensearch.packaging.util.Docker.verifyContainerInstallation;
import static org.opensearch.packaging.util.Docker.waitForElasticsearch;
import static org.opensearch.packaging.util.Docker.waitForOpenSearch;
import static org.opensearch.packaging.util.FileMatcher.p600;
import static org.opensearch.packaging.util.FileMatcher.p644;
import static org.opensearch.packaging.util.FileMatcher.p660;
@ -139,18 +139,18 @@ public class DockerTests extends PackagingTestCase {
* is minimally functional.
*/
public void test050BasicApiTests() throws Exception {
waitForElasticsearch(installation);
waitForOpenSearch(installation);
assertTrue(existsInContainer(installation.logs.resolve("gc.log")));
ServerUtils.runElasticsearchTests();
ServerUtils.runOpenSearchTests();
}
/**
* Check that the default config can be overridden using a bind mount, and that env vars are respected
*/
public void test070BindMountCustomPathConfAndJvmOptions() throws Exception {
copyFromContainer(installation.config("elasticsearch.yml"), tempDir.resolve("elasticsearch.yml"));
copyFromContainer(installation.config("opensearch.yml"), tempDir.resolve("opensearch.yml"));
copyFromContainer(installation.config("log4j2.properties"), tempDir.resolve("log4j2.properties"));
// we have to disable Log4j from using JMX lest it will hit a security
@ -162,15 +162,15 @@ public class DockerTests extends PackagingTestCase {
// Make the temp directory and contents accessible when bind-mounted.
Files.setPosixFilePermissions(tempDir, fromString("rwxrwxrwx"));
// These permissions are necessary to run the tests under Vagrant
Files.setPosixFilePermissions(tempDir.resolve("elasticsearch.yml"), p644);
Files.setPosixFilePermissions(tempDir.resolve("opensearch.yml"), p644);
Files.setPosixFilePermissions(tempDir.resolve("log4j2.properties"), p644);
// Restart the container
final Map<Path, Path> volumes = singletonMap(tempDir, Paths.get("/usr/share/elasticsearch/config"));
final Map<Path, Path> volumes = singletonMap(tempDir, Paths.get("/usr/share/opensearch/config"));
final Map<String, String> envVars = singletonMap("ES_JAVA_OPTS", "-XX:-UseCompressedOops");
runContainer(distribution(), volumes, envVars);
waitForElasticsearch(installation);
waitForOpenSearch(installation);
final JsonNode nodes = getJson("_nodes").get("nodes");
final String nodeId = nodes.fieldNames().next();
@ -198,7 +198,7 @@ public class DockerTests extends PackagingTestCase {
runContainer(distribution(), volumes, null);
waitForElasticsearch(installation);
waitForOpenSearch(installation);
final JsonNode nodes = getJson("_nodes");
@ -215,7 +215,7 @@ public class DockerTests extends PackagingTestCase {
}
/**
* Check that it is possible to run Elasticsearch under a different user and group to the default.
* Check that it is possible to run OpenSearch under a different user and group to the default.
*/
public void test072RunEsAsDifferentUserAndGroup() throws Exception {
assumeFalse(Platforms.WINDOWS);
@ -229,7 +229,7 @@ public class DockerTests extends PackagingTestCase {
Files.createDirectory(tempEsDataDir);
Files.createDirectory(tempEsLogsDir);
copyFromContainer(installation.config("elasticsearch.yml"), tempEsConfigDir);
copyFromContainer(installation.config("opensearch.yml"), tempEsConfigDir);
copyFromContainer(installation.config("jvm.options"), tempEsConfigDir);
copyFromContainer(installation.config("log4j2.properties"), tempEsConfigDir);
@ -246,7 +246,7 @@ public class DockerTests extends PackagingTestCase {
// Restart the container
runContainer(distribution(), volumes, null, 501, 501);
waitForElasticsearch(installation);
waitForOpenSearch(installation);
}
/**
@ -258,8 +258,8 @@ public class DockerTests extends PackagingTestCase {
Files.write(tempDir.resolve(passwordFilename), "other_hunter2\n".getBytes(StandardCharsets.UTF_8));
Map<String, String> envVars = new HashMap<>();
envVars.put("ELASTIC_PASSWORD", "hunter2");
envVars.put("ELASTIC_PASSWORD_FILE", "/run/secrets/" + passwordFilename);
envVars.put("OPENSEARCH_PASSWORD", "hunter2");
envVars.put("OPENSEARCH_PASSWORD_FILE", "/run/secrets/" + passwordFilename);
// File permissions need to be secured in order for the ES wrapper to accept
// them for populating env var values
@ -271,7 +271,7 @@ public class DockerTests extends PackagingTestCase {
assertThat(
dockerLogs.stderr,
containsString("ERROR: Both ELASTIC_PASSWORD_FILE and ELASTIC_PASSWORD are set. These are mutually exclusive.")
containsString("ERROR: Both OPENSEARCH_PASSWORD_FILE and OPENSEARCH_PASSWORD are set. These are mutually exclusive.")
);
}
@ -284,7 +284,7 @@ public class DockerTests extends PackagingTestCase {
Files.write(tempDir.resolve(passwordFilename), "hunter2\n".getBytes(StandardCharsets.UTF_8));
Map<String, String> envVars = singletonMap("ELASTIC_PASSWORD_FILE", "/run/secrets/" + passwordFilename);
Map<String, String> envVars = singletonMap("OPENSEARCH_PASSWORD_FILE", "/run/secrets/" + passwordFilename);
// Set invalid file permissions
Files.setPosixFilePermissions(tempDir.resolve(passwordFilename), p660);
@ -297,15 +297,15 @@ public class DockerTests extends PackagingTestCase {
assertThat(
dockerLogs.stderr,
containsString(
"ERROR: File /run/secrets/" + passwordFilename + " from ELASTIC_PASSWORD_FILE must have file permissions 400 or 600"
"ERROR: File /run/secrets/" + passwordFilename + " from OPENSEARCH_PASSWORD_FILE must have file permissions 400 or 600"
)
);
}
/**
* Check that the elasticsearch-shard tool is shipped in the Docker image and is executable.
* Check that the OpenSearch-shard tool is shipped in the Docker image and is executable.
*/
public void test091ElasticsearchShardCliPackaging() {
public void test091OpenSearchShardCliPackaging() {
final Installation.Executables bin = installation.executables();
final Result result = sh.run(bin.shardTool + " -h");
@ -313,14 +313,14 @@ public class DockerTests extends PackagingTestCase {
}
/**
* Check that the elasticsearch-node tool is shipped in the Docker image and is executable.
* Check that the OpenSearch-shard tool is shipped in the Docker image and is executable.
*/
public void test092OpensearchNodeCliPackaging() {
public void test092OpenSearchNodeCliPackaging() {
final Installation.Executables bin = installation.executables();
final Result result = sh.run(bin.nodeTool + " -h");
assertThat(
"Failed to find expected message about the elasticsearch-node CLI tool",
"Failed to find expected message about the OpenSearch-shard CLI tool",
result.stdout,
containsString("A CLI tool to " + "do unsafe cluster and index manipulations on current node")
);
@ -337,7 +337,7 @@ public class DockerTests extends PackagingTestCase {
* Check that there are no files with a GID other than 0.
*/
public void test101AllFilesAreGroupZero() {
// Run a `find` command in a new container without Elasticsearch running, so
// Run a `find` command in a new container without OpenSearch running, so
// that the results aren't subject to sporadic failures from files appearing /
// disappearing while `find` is traversing the filesystem.
//
@ -359,12 +359,12 @@ public class DockerTests extends PackagingTestCase {
final Map<String, String> labels = getImageLabels(distribution);
final Map<String, String> staticLabels = new HashMap<>();
staticLabels.put("name", "Elasticsearch");
staticLabels.put("name", "OpenSearch");
staticLabels.put("schema-version", "1.0");
staticLabels.put("url", "https://www.elastic.co/products/elasticsearch");
staticLabels.put("usage", "https://www.elastic.co/guide/en/elasticsearch/reference/index.html");
staticLabels.put("vcs-url", "https://github.com/elastic/elasticsearch");
staticLabels.put("vendor", "Elastic");
staticLabels.put("url", "https://www.opensearch.co/products/opensearch");
staticLabels.put("usage", "https://www.opensearch.co/guide/en/opensearch/reference/index.html");
staticLabels.put("vcs-url", "https://github.com/opensearch/opensearch");
staticLabels.put("vendor", "OpenSearch");
staticLabels.put("license", "Apache-2.0");
@ -396,11 +396,11 @@ public class DockerTests extends PackagingTestCase {
final Map<String, String> labels = getImageLabels(distribution);
final Map<String, String> staticLabels = new HashMap<>();
staticLabels.put("title", "Elasticsearch");
staticLabels.put("url", "https://www.elastic.co/products/elasticsearch");
staticLabels.put("documentation", "https://www.elastic.co/guide/en/elasticsearch/reference/index.html");
staticLabels.put("source", "https://github.com/elastic/elasticsearch");
staticLabels.put("vendor", "Elastic");
staticLabels.put("title", "OpenSearch");
staticLabels.put("url", "https://www.opensearch.co/products/opensearch");
staticLabels.put("documentation", "https://www.opensearch.co/guide/en/opensearch/reference/index.html");
staticLabels.put("source", "https://github.com/opensearch/opensearch");
staticLabels.put("vendor", "OpenSearch");
staticLabels.put("licenses", "Apache-2.0");
@ -425,10 +425,10 @@ public class DockerTests extends PackagingTestCase {
}
/**
* Check that the container logs contain the expected content for Elasticsearch itself.
* Check that the container logs contain the expected content for OpenSearch itself.
*/
public void test120DockerLogsIncludeElasticsearchLogs() throws Exception {
waitForElasticsearch(installation);
public void test120DockerLogsIncludeOpenSearchLogs() throws Exception {
waitForOpenSearch(installation);
final Result containerLogs = getContainerLogs();
assertThat("Container logs don't contain abbreviated class names", containerLogs.stdout, containsString("o.e.n.Node"));
@ -450,7 +450,7 @@ public class DockerTests extends PackagingTestCase {
assertThat(fields, arrayWithSize(3));
assertThat("Incorrect UID", fields[0], equalTo("1000"));
assertThat("Incorrect GID", fields[1], equalTo("0"));
assertThat("Incorrect username", fields[2], equalTo("elasticsearch"));
assertThat("Incorrect username", fields[2], equalTo("opensearch"));
}
/**
@ -474,10 +474,10 @@ public class DockerTests extends PackagingTestCase {
}
/**
* Check that Elasticsearch reports per-node cgroup information.
* Check that Opensearch reports per-node cgroup information.
*/
public void test140CgroupOsStatsAreAvailable() throws Exception {
waitForElasticsearch(installation);
waitForOpenSearch(installation);
final JsonNode nodes = getJson("_nodes/stats/os").get("nodes");

View File

@ -47,7 +47,7 @@ import static org.opensearch.packaging.util.Archives.verifyArchiveInstallation;
import static org.opensearch.packaging.util.Docker.assertPermissionsAndOwnership;
import static org.opensearch.packaging.util.Docker.runContainer;
import static org.opensearch.packaging.util.Docker.runContainerExpectingFailure;
import static org.opensearch.packaging.util.Docker.waitForElasticsearch;
import static org.opensearch.packaging.util.Docker.waitForOpenSearch;
import static org.opensearch.packaging.util.Docker.waitForPathToExist;
import static org.opensearch.packaging.util.FileMatcher.Fileness.File;
import static org.opensearch.packaging.util.FileMatcher.file;
@ -110,7 +110,7 @@ public class KeystoreManagementTests extends PackagingTestCase {
installation = Docker.runContainer(distribution());
try {
waitForPathToExist(installation.config("elasticsearch.keystore"));
waitForPathToExist(installation.config("opensearch.keystore"));
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
@ -138,10 +138,10 @@ public class KeystoreManagementTests extends PackagingTestCase {
assumeTrue("Packages and docker are installed with a keystore file", distribution.isArchive());
rmKeystoreIfExists();
startElasticsearch();
stopElasticsearch();
startOpenSearch();
stopOpenSearch();
Platforms.onWindows(() -> sh.chown(installation.config("elasticsearch.keystore")));
Platforms.onWindows(() -> sh.chown(installation.config("opensearch.keystore")));
verifyKeystorePermissions();
@ -161,9 +161,9 @@ public class KeystoreManagementTests extends PackagingTestCase {
assertPasswordProtectedKeystore();
awaitElasticsearchStartup(runElasticsearchStartCommand(password, true, false));
ServerUtils.runElasticsearchTests();
stopElasticsearch();
awaitElasticsearchStartup(runOpenSearchStartCommand(password, true, false));
ServerUtils.runOpenSearchTests();
stopOpenSearch();
}
public void test41WrongKeystorePasswordOnStandardInput() throws Exception {
@ -172,8 +172,8 @@ public class KeystoreManagementTests extends PackagingTestCase {
assertPasswordProtectedKeystore();
Shell.Result result = runElasticsearchStartCommand("wrong", false, false);
assertElasticsearchFailure(result, Arrays.asList(ERROR_INCORRECT_PASSWORD, ERROR_CORRUPTED_KEYSTORE), null);
Shell.Result result = runOpenSearchStartCommand("wrong", false, false);
assertOpenSearchFailure(result, Arrays.asList(ERROR_INCORRECT_PASSWORD, ERROR_CORRUPTED_KEYSTORE), null);
}
/**
@ -192,9 +192,9 @@ public class KeystoreManagementTests extends PackagingTestCase {
assertPasswordProtectedKeystore();
awaitElasticsearchStartup(runElasticsearchStartCommand(password, false, true));
ServerUtils.runElasticsearchTests();
stopElasticsearch();
awaitElasticsearchStartup(runOpenSearchStartCommand(password, false, true));
ServerUtils.runOpenSearchTests();
stopOpenSearch();
}
@Ignore // awaits fix: https://github.com/elastic/elasticsearch/issues/49340
@ -211,9 +211,9 @@ public class KeystoreManagementTests extends PackagingTestCase {
assertPasswordProtectedKeystore();
awaitElasticsearchStartup(runElasticsearchStartCommand(password, true, true));
ServerUtils.runElasticsearchTests();
stopElasticsearch();
awaitOpenSearchStartup(runOpenSearchStartCommand(password, true, true));
ServerUtils.runOpenSearchTests();
stopOpenSearch();
}
public void test44WrongKeystorePasswordOnTty() throws Exception {
@ -226,7 +226,7 @@ public class KeystoreManagementTests extends PackagingTestCase {
// daemonization shouldn't matter for this test
boolean daemonize = randomBoolean();
Shell.Result result = runElasticsearchStartCommand("wrong", daemonize, true);
Shell.Result result = runOpenSearchStartCommand("wrong", daemonize, true);
// error will be on stdout for "expect"
assertThat(result.stdout, anyOf(containsString(ERROR_INCORRECT_PASSWORD), containsString(ERROR_CORRUPTED_KEYSTORE)));
}
@ -236,7 +236,7 @@ public class KeystoreManagementTests extends PackagingTestCase {
* view help information.
*/
public void test45EncryptedKeystoreAllowsHelpMessage() throws Exception {
assumeTrue("users call elasticsearch directly in archive case", distribution.isArchive());
assumeTrue("users call opensearch directly in archive case", distribution.isArchive());
String password = "keystorepass";
@ -244,8 +244,8 @@ public class KeystoreManagementTests extends PackagingTestCase {
createKeystore(password);
assertPasswordProtectedKeystore();
Shell.Result r = installation.executables().elasticsearch.run("--help");
assertThat(r.stdout, startsWith("Starts Elasticsearch"));
Shell.Result r = installation.executables().opensearch.run("--help");
assertThat(r.stdout, startsWith("Starts OpenSearch"));
}
public void test50KeystorePasswordFromFile() throws Exception {
@ -264,9 +264,9 @@ public class KeystoreManagementTests extends PackagingTestCase {
Files.createFile(esKeystorePassphraseFile);
Files.write(esKeystorePassphraseFile, singletonList(password));
startElasticsearch();
ServerUtils.runElasticsearchTests();
stopElasticsearch();
startOpenSearch();
ServerUtils.runOpenSearchTests();
stopOpenSearch();
} finally {
sh.run("sudo systemctl unset-environment ES_KEYSTORE_PASSPHRASE_FILE");
}
@ -289,8 +289,8 @@ public class KeystoreManagementTests extends PackagingTestCase {
Files.write(esKeystorePassphraseFile, singletonList("wrongpassword"));
Packages.JournaldWrapper journaldWrapper = new Packages.JournaldWrapper(sh);
Shell.Result result = runElasticsearchStartCommand(null, false, false);
assertElasticsearchFailure(result, Arrays.asList(ERROR_INCORRECT_PASSWORD, ERROR_CORRUPTED_KEYSTORE), journaldWrapper);
Shell.Result result = runOpenSearchStartCommand(null, false, false);
assertOpenSearchFailure(result, Arrays.asList(ERROR_INCORRECT_PASSWORD, ERROR_CORRUPTED_KEYSTORE), journaldWrapper);
} finally {
sh.run("sudo systemctl unset-environment ES_KEYSTORE_PASSPHRASE_FILE");
}
@ -303,7 +303,7 @@ public class KeystoreManagementTests extends PackagingTestCase {
public void test60DockerEnvironmentVariablePassword() throws Exception {
assumeTrue(distribution().isDocker());
String password = "password";
Path dockerKeystore = installation.config("elasticsearch.keystore");
Path dockerKeystore = installation.config("opensearch.keystore");
Path localKeystoreFile = getKeystoreFileFromDockerContainer(password, dockerKeystore);
@ -313,8 +313,8 @@ public class KeystoreManagementTests extends PackagingTestCase {
Map<String, String> envVars = new HashMap<>();
envVars.put("KEYSTORE_PASSWORD", password);
runContainer(distribution(), volumes, envVars);
waitForElasticsearch(installation);
ServerUtils.runElasticsearchTests();
waitForOpenSearch(installation);
ServerUtils.runOpenSearchTests();
}
/**
@ -333,7 +333,7 @@ public class KeystoreManagementTests extends PackagingTestCase {
Files.write(tempDir.resolve(passwordFilename), singletonList(password));
Files.setPosixFilePermissions(tempDir.resolve(passwordFilename), p600);
Path dockerKeystore = installation.config("elasticsearch.keystore");
Path dockerKeystore = installation.config("opensearch.keystore");
Path localKeystoreFile = getKeystoreFileFromDockerContainer(password, dockerKeystore);
@ -347,8 +347,8 @@ public class KeystoreManagementTests extends PackagingTestCase {
runContainer(distribution(), volumes, envVars);
waitForElasticsearch(installation);
ServerUtils.runElasticsearchTests();
waitForOpenSearch(installation);
ServerUtils.runOpenSearchTests();
} finally {
if (tempDir != null) {
rm(tempDir);
@ -363,7 +363,7 @@ public class KeystoreManagementTests extends PackagingTestCase {
public void test62DockerEnvironmentVariableBadPassword() throws Exception {
assumeTrue(distribution().isDocker());
String password = "password";
Path dockerKeystore = installation.config("elasticsearch.keystore");
Path dockerKeystore = installation.config("opensearch.keystore");
Path localKeystoreFile = getKeystoreFileFromDockerContainer(password, dockerKeystore);
@ -417,12 +417,12 @@ public class KeystoreManagementTests extends PackagingTestCase {
// copy keystore to temp file to make it available to docker host
sh.run("cp " + dockerKeystore + " " + dockerTemp);
return tempDirectory.resolve("elasticsearch.keystore");
return tempDirectory.resolve("opensearch.keystore");
}
/** Create a keystore. Provide a password to password-protect it, otherwise use null */
private void createKeystore(String password) throws Exception {
Path keystore = installation.config("elasticsearch.keystore");
Path keystore = installation.config("opensearch.keystore");
final Installation.Executables bin = installation.executables();
bin.keystoreTool.run("create");
@ -446,7 +446,7 @@ public class KeystoreManagementTests extends PackagingTestCase {
}
private void rmKeystoreIfExists() {
Path keystore = installation.config("elasticsearch.keystore");
Path keystore = installation.config("opensearch.keystore");
if (distribution().isDocker()) {
try {
waitForPathToExist(keystore);
@ -480,7 +480,7 @@ public class KeystoreManagementTests extends PackagingTestCase {
}
private void verifyKeystorePermissions() {
Path keystore = installation.config("elasticsearch.keystore");
Path keystore = installation.config("opensearch.keystore");
switch (distribution.packaging) {
case TAR:
case ZIP:

View File

@ -47,12 +47,12 @@ import static org.opensearch.packaging.util.Packages.assertInstalled;
import static org.opensearch.packaging.util.Packages.assertRemoved;
import static org.opensearch.packaging.util.Packages.installPackage;
import static org.opensearch.packaging.util.Packages.remove;
import static org.opensearch.packaging.util.Packages.restartElasticsearch;
import static org.opensearch.packaging.util.Packages.restartOpenSearch;
import static org.opensearch.packaging.util.Packages.verifyPackageInstallation;
import static org.opensearch.packaging.util.Platforms.getOsRelease;
import static org.opensearch.packaging.util.Platforms.isSystemd;
import static org.opensearch.packaging.util.ServerUtils.makeRequest;
import static org.opensearch.packaging.util.ServerUtils.runElasticsearchTests;
import static org.opensearch.packaging.util.ServerUtils.runOpenSearchTests;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.Matchers.containsString;
@ -76,33 +76,33 @@ public class PackageTests extends PackagingTestCase {
}
public void test20PluginsCommandWhenNoPlugins() {
assertThat(sh.run(installation.bin("elasticsearch-plugin") + " list").stdout, is(emptyString()));
assertThat(sh.run(installation.bin("opensearch-plugin") + " list").stdout, is(emptyString()));
}
public void test30DaemonIsNotEnabledOnRestart() {
if (isSystemd()) {
sh.run("systemctl daemon-reload");
String isEnabledOutput = sh.runIgnoreExitCode("systemctl is-enabled elasticsearch.service").stdout.trim();
String isEnabledOutput = sh.runIgnoreExitCode("systemctl is-enabled opensearch.service").stdout.trim();
assertThat(isEnabledOutput, equalTo("disabled"));
}
}
public void test31InstallDoesNotStartServer() {
assertThat(sh.run("ps aux").stdout, not(containsString("org.opensearch.bootstrap.Elasticsearch")));
assertThat(sh.run("ps aux").stdout, not(containsString("org.opensearch.bootstrap.OpenSearch")));
}
private void assertRunsWithJavaHome() throws Exception {
byte[] originalEnvFile = Files.readAllBytes(installation.envFile);
try {
Files.write(installation.envFile, singletonList("JAVA_HOME=" + systemJavaHome), APPEND);
startElasticsearch();
runElasticsearchTests();
stopElasticsearch();
startOpenSearch();
runOpenSearchTests();
stopOpenSearch();
} finally {
Files.write(installation.envFile, originalEnvFile);
}
assertThat(FileUtils.slurpAllLogs(installation.logs, "elasticsearch.log", "elasticsearch*.log.gz"), containsString(systemJavaHome));
assertThat(FileUtils.slurpAllLogs(installation.logs, "opensearch.log", "elasticsearch*.log.gz"), containsString(systemJavaHome));
}
public void test32JavaHomeOverride() throws Exception {
@ -122,9 +122,9 @@ public class PackageTests extends PackagingTestCase {
}
try {
startElasticsearch();
runElasticsearchTests();
stopElasticsearch();
startOpenSearch();
runOpenSearchTests();
stopOpenSearch();
} finally {
if (Files.exists(Paths.get(backupPath))) {
sh.run("sudo mv " + backupPath + " /usr/bin/java");
@ -137,12 +137,12 @@ public class PackageTests extends PackagingTestCase {
try {
append(heapOptions, "-Xms512m\n-Xmx512m\n");
startElasticsearch();
startOpenSearch();
final String nodesResponse = makeRequest(Request.Get("http://localhost:9200/_nodes"));
assertThat(nodesResponse, containsString("\"heap_init_in_bytes\":536870912"));
stopElasticsearch();
stopOpenSearch();
} finally {
rm(heapOptions);
}
@ -162,22 +162,22 @@ public class PackageTests extends PackagingTestCase {
public void test40StartServer() throws Exception {
String start = sh.runIgnoreExitCode("date ").stdout.trim();
startElasticsearch();
startOpenSearch();
String journalEntries = sh.runIgnoreExitCode(
"journalctl _SYSTEMD_UNIT=elasticsearch.service "
"journalctl _SYSTEMD_UNIT=opensearch.service "
+ "--since \""
+ start
+ "\" --output cat | grep -v \"future versions of Elasticsearch will require Java 11\" | wc -l"
).stdout.trim();
assertThat(journalEntries, equalTo("0"));
assertPathsExist(installation.pidDir.resolve("elasticsearch.pid"));
assertPathsExist(installation.pidDir.resolve("opensearch.pid"));
assertPathsExist(installation.logs.resolve("elasticsearch_server.json"));
runElasticsearchTests();
runOpenSearchTests();
verifyPackageInstallation(installation, distribution(), sh); // check startup script didn't change permissions
stopElasticsearch();
stopOpenSearch();
}
public void test50Remove() throws Exception {
@ -212,8 +212,8 @@ public class PackageTests extends PackagingTestCase {
statusExitCode = version < 231 ? 3 : 4;
}
assertThat(sh.runIgnoreExitCode("systemctl status elasticsearch.service").exitCode, is(statusExitCode));
assertThat(sh.runIgnoreExitCode("systemctl is-enabled elasticsearch.service").exitCode, is(1));
assertThat(sh.runIgnoreExitCode("systemctl status opensearch.service").exitCode, is(statusExitCode));
assertThat(sh.runIgnoreExitCode("systemctl is-enabled opensearch.service").exitCode, is(1));
}
@ -243,10 +243,10 @@ public class PackageTests extends PackagingTestCase {
install();
assertInstalled(distribution());
startElasticsearch();
restartElasticsearch(sh, installation);
runElasticsearchTests();
stopElasticsearch();
startOpenSearch();
restartOpenSearch(sh, installation);
runOpenSearchTests();
stopOpenSearch();
} finally {
cleanup();
}
@ -256,9 +256,9 @@ public class PackageTests extends PackagingTestCase {
try {
install();
FileUtils.rm(installation.pidDir);
startElasticsearch();
startOpenSearch();
assertPathsExist(installation.pidDir);
stopElasticsearch();
stopOpenSearch();
} finally {
cleanup();
}
@ -266,10 +266,10 @@ public class PackageTests extends PackagingTestCase {
public void test73gcLogsExist() throws Exception {
install();
startElasticsearch();
startOpenSearch();
// it can be gc.log or gc.log.0.current
assertThat(installation.logs, fileWithGlobExist("gc.log*"));
stopElasticsearch();
stopOpenSearch();
}
// TEST CASES FOR SYSTEMD ONLY
@ -287,31 +287,31 @@ public class PackageTests extends PackagingTestCase {
sh.run("systemd-tmpfiles --create");
startElasticsearch();
startOpenSearch();
final Path pidFile = installation.pidDir.resolve("elasticsearch.pid");
final Path pidFile = installation.pidDir.resolve("opensearch.pid");
assertThat(pidFile, fileExists());
stopElasticsearch();
stopOpenSearch();
}
public void test81CustomPathConfAndJvmOptions() throws Exception {
assumeTrue(isSystemd());
assertPathsExist(installation.envFile);
stopElasticsearch();
stopOpenSearch();
withCustomConfig(tempConf -> {
append(installation.envFile, "ES_JAVA_OPTS=-XX:-UseCompressedOops");
startElasticsearch();
startOpenSearch();
final String nodesResponse = makeRequest(Request.Get("http://localhost:9200/_nodes"));
assertThat(nodesResponse, containsString("\"heap_init_in_bytes\":1073741824"));
assertThat(nodesResponse, containsString("\"using_compressed_ordinary_object_pointers\":\"false\""));
stopElasticsearch();
stopOpenSearch();
});
cleanup();
@ -336,9 +336,9 @@ public class PackageTests extends PackagingTestCase {
install();
startElasticsearch();
startOpenSearch();
final Path pidFile = installation.pidDir.resolve("elasticsearch.pid");
final Path pidFile = installation.pidDir.resolve("opensearch.pid");
assertThat(pidFile, fileExists());
String pid = slurp(pidFile).trim();
String maxFileSize = sh.run("cat /proc/%s/limits | grep \"Max file size\" | awk '{ print $4 }'", pid).stdout.trim();
@ -353,25 +353,25 @@ public class PackageTests extends PackagingTestCase {
String maxAddressSpace = sh.run("cat /proc/%s/limits | grep \"Max address space\" | awk '{ print $4 }'", pid).stdout.trim();
assertThat(maxAddressSpace, equalTo("unlimited"));
stopElasticsearch();
stopOpenSearch();
}
public void test90DoNotCloseStderrWhenQuiet() throws Exception {
assumeTrue(isSystemd());
assertPathsExist(installation.envFile);
stopElasticsearch();
stopOpenSearch();
withCustomConfig(tempConf -> {
// Create a startup problem by adding an invalid YAML line to the config
append(tempConf.resolve("elasticsearch.yml"), "discovery.zen.ping.unicast.hosts:15172.30.5.3416172.30.5.35, 172.30.5.17]\n");
append(tempConf.resolve("opensearch.yml"), "discovery.zen.ping.unicast.hosts:15172.30.5.3416172.30.5.35, 172.30.5.17]\n");
// Make sure we don't pick up the journal entries for previous ES instances.
Packages.JournaldWrapper journald = new Packages.JournaldWrapper(sh);
runElasticsearchStartCommand(null, true, false);
runOpenSearchStartCommand(null, true, false);
final Result logs = journald.getLogs();
assertThat(logs.stdout, containsString("Failed to load settings from [elasticsearch.yml]"));
assertThat(logs.stdout, containsString("Failed to load settings from [opensearch.yml]"));
});
}
}

View File

@ -53,7 +53,7 @@ public class PackageUpgradeTests extends PackagingTestCase {
}
public void test12SetupBwcVersion() throws Exception {
startElasticsearch();
startOpenSearch();
// create indexes explicitly with 0 replicas so when restarting we can reach green state
makeRequest(
@ -81,7 +81,7 @@ public class PackageUpgradeTests extends PackagingTestCase {
assertDocsExist();
stopElasticsearch();
stopOpenSearch();
}
public void test20InstallUpgradedVersion() throws Exception {

View File

@ -178,19 +178,19 @@ public abstract class PackagingTestCase extends Assert {
public void teardown() throws Exception {
if (installation != null && failed == false) {
if (Files.exists(installation.logs)) {
Path logFile = installation.logs.resolve("elasticsearch.log");
Path logFile = installation.logs.resolve("opensearch.log");
if (Files.exists(logFile)) {
logger.warn("Elasticsearch log:\n" + FileUtils.slurpAllLogs(installation.logs, "elasticsearch.log", "*.log.gz"));
logger.warn("OpenSearch log:\n" + FileUtils.slurpAllLogs(installation.logs, "opensearch.log", "*.log.gz"));
}
// move log file so we can avoid false positives when grepping for
// messages in logs during test
String prefix = this.getClass().getSimpleName() + "." + testNameRule.getMethodName();
if (Files.exists(logFile)) {
Path newFile = installation.logs.resolve(prefix + ".elasticsearch.log");
Path newFile = installation.logs.resolve(prefix + ".opensearch.log");
FileUtils.mv(logFile, newFile);
}
for (Path rotatedLogFile : FileUtils.lsGlob(installation.logs, "elasticsearch*.tar.gz")) {
for (Path rotatedLogFile : FileUtils.lsGlob(installation.logs, "opensearch*.tar.gz")) {
Path newRotatedLogFile = installation.logs.resolve(prefix + "." + rotatedLogFile.getFileName());
FileUtils.mv(rotatedLogFile, newRotatedLogFile);
}
@ -224,7 +224,7 @@ public abstract class PackagingTestCase extends Assert {
Docker.verifyContainerInstallation(installation, distribution);
break;
default:
throw new IllegalStateException("Unknown Elasticsearch packaging type.");
throw new IllegalStateException("Unknown OpenSearch packaging type.");
}
}
@ -234,19 +234,19 @@ public abstract class PackagingTestCase extends Assert {
}
/**
* Starts and stops elasticsearch, and performs assertions while it is running.
* Starts and stops opensearch, and performs assertions while it is running.
*/
protected void assertWhileRunning(Platforms.PlatformAction assertions) throws Exception {
try {
awaitElasticsearchStartup(runElasticsearchStartCommand(null, true, false));
awaitOpenSearchStartup(runOpenSearchStartCommand(null, true, false));
} catch (Exception e) {
if (Files.exists(installation.home.resolve("elasticsearch.pid"))) {
String pid = FileUtils.slurp(installation.home.resolve("elasticsearch.pid")).trim();
logger.info("Dumping jstack of elasticsearch processb ({}) that failed to start", pid);
if (Files.exists(installation.home.resolve("opensearch.pid"))) {
String pid = FileUtils.slurp(installation.home.resolve("opensearch.pid")).trim();
logger.info("Dumping jstack of opensearch processb ({}) that failed to start", pid);
sh.runIgnoreExitCode("jstack " + pid);
}
if (Files.exists(installation.logs.resolve("elasticsearch.log"))) {
logger.warn("Elasticsearch log:\n" + FileUtils.slurpAllLogs(installation.logs, "elasticsearch.log", "*.log.gz"));
if (Files.exists(installation.logs.resolve("opensearch.log"))) {
logger.warn("OpenSearch log:\n" + FileUtils.slurpAllLogs(installation.logs, "opensearch.log", "*.log.gz"));
}
if (Files.exists(installation.logs.resolve("output.out"))) {
logger.warn("Stdout:\n" + FileUtils.slurpTxtorGz(installation.logs.resolve("output.out")));
@ -260,25 +260,25 @@ public abstract class PackagingTestCase extends Assert {
try {
assertions.run();
} catch (Exception e) {
logger.warn("Elasticsearch log:\n" + FileUtils.slurpAllLogs(installation.logs, "elasticsearch.log", "*.log.gz"));
logger.warn("OpenSearch log:\n" + FileUtils.slurpAllLogs(installation.logs, "opensearch.log", "*.log.gz"));
throw e;
}
stopElasticsearch();
stopOpenSearch();
}
/**
* Run the command to start Elasticsearch, but don't wait or test for success.
* Run the command to start OpenSearch, but don't wait or test for success.
* This method is useful for testing failure conditions in startup. To await success,
* use {@link #startElasticsearch()}.
* use {@link #startOpenSearch()}.
* @param password Password for password-protected keystore, null for no password;
* this option will fail for non-archive distributions
* @param daemonize Run Elasticsearch in the background
* @param daemonize Run OpenSearch in the background
* @param useTty Use a tty for inputting the password rather than standard input;
* this option will fail for non-archive distributions
* @return Shell results of the startup command.
* @throws Exception when command fails immediately.
*/
public Shell.Result runElasticsearchStartCommand(String password, boolean daemonize, boolean useTty) throws Exception {
public Shell.Result runOpenSearchStartCommand(String password, boolean daemonize, boolean useTty) throws Exception {
if (password != null) {
assertTrue("Only archives support user-entered passwords", distribution().isArchive());
}
@ -287,87 +287,87 @@ public abstract class PackagingTestCase extends Assert {
case TAR:
case ZIP:
if (useTty) {
return Archives.startElasticsearchWithTty(installation, sh, password, daemonize);
return Archives.startOpenSearchWithTty(installation, sh, password, daemonize);
} else {
return Archives.runElasticsearchStartCommand(installation, sh, password, daemonize);
return Archives.runOpenSearchStartCommand(installation, sh, password, daemonize);
}
case DEB:
case RPM:
return Packages.runElasticsearchStartCommand(sh);
return Packages.runOpenSearchStartCommand(sh);
case DOCKER:
// nothing, "installing" docker image is running it
return Shell.NO_OP;
default:
throw new IllegalStateException("Unknown Elasticsearch packaging type.");
throw new IllegalStateException("Unknown OpenSearch packaging type.");
}
}
public void stopElasticsearch() throws Exception {
public void stopOpenSearch() throws Exception {
switch (distribution.packaging) {
case TAR:
case ZIP:
Archives.stopElasticsearch(installation);
Archives.stopOpenSearch(installation);
break;
case DEB:
case RPM:
Packages.stopElasticsearch(sh);
Packages.stopOpenSearch(sh);
break;
case DOCKER:
// nothing, "installing" docker image is running it
break;
default:
throw new IllegalStateException("Unknown Elasticsearch packaging type.");
throw new IllegalStateException("Unknown OpenSearch packaging type.");
}
}
public void awaitElasticsearchStartup(Shell.Result result) throws Exception {
public void awaitOpenSearchStartup(Shell.Result result) throws Exception {
assertThat("Startup command should succeed", result.exitCode, equalTo(0));
switch (distribution.packaging) {
case TAR:
case ZIP:
Archives.assertElasticsearchStarted(installation);
Archives.assertOpenSearchStarted(installation);
break;
case DEB:
case RPM:
Packages.assertElasticsearchStarted(sh, installation);
Packages.assertOpenSearchStarted(sh, installation);
break;
case DOCKER:
Docker.waitForElasticsearchToStart();
Docker.waitForOpenSearchToStart();
break;
default:
throw new IllegalStateException("Unknown Elasticsearch packaging type.");
throw new IllegalStateException("Unknown OpenSearch packaging type.");
}
}
/**
* Start Elasticsearch and wait until it's up and running. If you just want to run
* the start command, use {@link #runElasticsearchStartCommand(String, boolean, boolean)}.
* @throws Exception if Elasticsearch can't start
* Start OpenSearch and wait until it's up and running. If you just want to run
* the start command, use {@link #runOpenSearchStartCommand(String, boolean, boolean)}.
* @throws Exception if Opensearch can't start
*/
public void startElasticsearch() throws Exception {
awaitElasticsearchStartup(runElasticsearchStartCommand(null, true, false));
public void startOpenSearch() throws Exception {
awaitOpenSearchStartup(runOpenSearchStartCommand(null, true, false));
}
public void assertElasticsearchFailure(Shell.Result result, String expectedMessage, Packages.JournaldWrapper journaldWrapper) {
assertElasticsearchFailure(result, Collections.singletonList(expectedMessage), journaldWrapper);
public void assertOpenSearchFailure(Shell.Result result, String expectedMessage, Packages.JournaldWrapper journaldWrapper) {
assertOpenSearchFailure(result, Collections.singletonList(expectedMessage), journaldWrapper);
}
public void assertElasticsearchFailure(Shell.Result result, List<String> expectedMessages, Packages.JournaldWrapper journaldWrapper) {
public void assertOpenSearchFailure(Shell.Result result, List<String> expectedMessages, Packages.JournaldWrapper journaldWrapper) {
@SuppressWarnings("unchecked")
Matcher<String>[] stringMatchers = expectedMessages.stream().map(CoreMatchers::containsString).toArray(Matcher[]::new);
if (Files.exists(installation.logs.resolve("elasticsearch.log"))) {
if (Files.exists(installation.logs.resolve("opensearch.log"))) {
// If log file exists, then we have bootstrapped our logging and the
// error should be in the logs
assertThat(installation.logs.resolve("elasticsearch.log"), fileExists());
String logfile = FileUtils.slurp(installation.logs.resolve("elasticsearch.log"));
assertThat(installation.logs.resolve("opensearch.log"), fileExists());
String logfile = FileUtils.slurp(installation.logs.resolve("opensearch.log"));
assertThat(logfile, anyOf(stringMatchers));
} else if (distribution().isPackage() && Platforms.isSystemd()) {
// For systemd, retrieve the error from journalctl
assertThat(result.stderr, containsString("Job for elasticsearch.service failed"));
assertThat(result.stderr, containsString("Job for opensearch.service failed"));
Shell.Result error = journaldWrapper.getLogs();
assertThat(error.stdout, anyOf(stringMatchers));
@ -420,18 +420,18 @@ public abstract class PackagingTestCase extends Assert {
* Run the given action with a temporary copy of the config directory.
*
* Files under the path passed to the action may be modified as necessary for the
* test to execute, and running Elasticsearch with {@link #startElasticsearch()} will
* test to execute, and running OpenSearch with {@link #startOpenSearch()} will
* use the temporary directory.
*/
public void withCustomConfig(CheckedConsumer<Path, Exception> action) throws Exception {
Path tempDir = createTempDir("custom-config");
Path tempConf = tempDir.resolve("elasticsearch");
Path tempConf = tempDir.resolve("opensearch");
FileUtils.copyDirectory(installation.config, tempConf);
Platforms.onLinux(() -> sh.run("chown -R elasticsearch:elasticsearch " + tempDir));
Platforms.onLinux(() -> sh.run("chown -R opensearch:opensearch " + tempDir));
if (distribution.isPackage()) {
Files.copy(installation.envFile, tempDir.resolve("elasticsearch.bk"));// backup
Files.copy(installation.envFile, tempDir.resolve("opensearch.bk"));// backup
append(installation.envFile, "ES_PATH_CONF=" + tempConf + "\n");
} else {
sh.getEnv().put("ES_PATH_CONF", tempConf.toString());
@ -440,7 +440,7 @@ public abstract class PackagingTestCase extends Assert {
action.accept(tempConf);
if (distribution.isPackage()) {
IOUtils.rm(installation.envFile);
Files.copy(tempDir.resolve("elasticsearch.bk"), installation.envFile);
Files.copy(tempDir.resolve("opensearch.bk"), installation.envFile);
} else {
sh.getEnv().remove("ES_PATH_CONF");
}

View File

@ -76,7 +76,7 @@ public class PluginCliTests extends PackagingTestCase {
Files.delete(stashedPluginsDir); // delete so we can replace it
Files.move(pluginsDir, stashedPluginsDir);
Path linkedPlugins = createTempDir("symlinked-plugins");
Platforms.onLinux(() -> sh.run("chown elasticsearch:elasticsearch " + linkedPlugins.toString()));
Platforms.onLinux(() -> sh.run("chown opensearch:opensearch " + linkedPlugins.toString()));
Files.createSymbolicLink(pluginsDir, linkedPlugins);
assertWithExamplePlugin(installResult -> {
assertWhileRunning(() -> {
@ -103,17 +103,17 @@ public class PluginCliTests extends PackagingTestCase {
assertWithPlugin(installation.executables().pluginTool, plugin, EXAMPLE_PLUGIN_NAME, installResult -> {});
}
public void test23ElasticsearchWithSpace() throws Exception {
public void test23OpenSearchWithSpace() throws Exception {
assumeTrue(distribution.isArchive());
Path spacedDir = createTempDir("spaced dir");
Path elasticsearch = spacedDir.resolve("elasticsearch");
Files.move(installation.home, elasticsearch);
Installation spacedInstallation = Installation.ofArchive(sh, distribution, elasticsearch);
Path opensearch = spacedDir.resolve("opensearch");
Files.move(installation.home, opensearch);
Installation spacedInstallation = Installation.ofArchive(sh, distribution, opensearch);
assertWithPlugin(spacedInstallation.executables().pluginTool, EXAMPLE_PLUGIN_ZIP, EXAMPLE_PLUGIN_NAME, installResult -> {});
Files.move(elasticsearch, installation.home);
Files.move(opensearch, installation.home);
}
public void test24JavaOpts() throws Exception {

View File

@ -78,7 +78,7 @@ public class RpmPreservationTests extends PackagingTestCase {
verifyPackageInstallation(installation, distribution(), sh);
sh.run("echo foobar | " + installation.executables().keystoreTool + " add --stdin foo.bar");
Stream.of("elasticsearch.yml", "jvm.options", "log4j2.properties")
Stream.of("opensearch.yml", "jvm.options", "log4j2.properties")
.map(each -> installation.config(each))
.forEach(path -> append(path, "# foo"));
append(installation.config(Paths.get("jvm.options.d", "heap.options")), "# foo");
@ -87,7 +87,7 @@ public class RpmPreservationTests extends PackagingTestCase {
assertRemoved(distribution());
if (isSystemd()) {
assertThat(sh.runIgnoreExitCode("systemctl is-enabled elasticsearch.service").exitCode, is(1));
assertThat(sh.runIgnoreExitCode("systemctl is-enabled opensearch.service").exitCode, is(1));
}
assertPathsDoNotExist(
@ -103,9 +103,9 @@ public class RpmPreservationTests extends PackagingTestCase {
);
assertThat(installation.config, fileExists());
assertThat(installation.config("elasticsearch.keystore"), fileExists());
assertThat(installation.config("opensearch.keystore"), fileExists());
Stream.of("elasticsearch.yml", "jvm.options", "log4j2.properties").forEach(this::assertConfFilePreserved);
Stream.of("opensearch.yml", "jvm.options", "log4j2.properties").forEach(this::assertConfFilePreserved);
assertThat(installation.config(Paths.get("jvm.options.d", "heap.options")), fileExists());
}

View File

@ -41,15 +41,15 @@ public class SysVInitTests extends PackagingTestCase {
}
@Override
public void startElasticsearch() throws Exception {
sh.run("service elasticsearch start");
ServerUtils.waitForElasticsearch(installation);
sh.run("service elasticsearch status");
public void startOpenSearch() throws Exception {
sh.run("service opensearch start");
ServerUtils.waitForOpenSearch(installation);
sh.run("service opensearch status");
}
@Override
public void stopElasticsearch() {
sh.run("service elasticsearch stop");
public void stopOpenSearch() {
sh.run("service opensearch stop");
}
public void test10Install() throws Exception {
@ -57,20 +57,20 @@ public class SysVInitTests extends PackagingTestCase {
}
public void test20Start() throws Exception {
startElasticsearch();
startOpenSearch();
assertThat(installation.logs, fileWithGlobExist("gc.log*"));
ServerUtils.runElasticsearchTests();
sh.run("service elasticsearch status"); // returns 0 exit status when ok
ServerUtils.runOpenSearchTests();
sh.run("service opensearch status"); // returns 0 exit status when ok
}
public void test21Restart() throws Exception {
sh.run("service elasticsearch restart");
sh.run("service elasticsearch status"); // returns 0 exit status when ok
sh.run("service opensearch restart");
sh.run("service opensearch status"); // returns 0 exit status when ok
}
public void test22Stop() throws Exception {
stopElasticsearch();
Shell.Result status = sh.runIgnoreExitCode("service elasticsearch status");
stopOpenSearch();
Shell.Result status = sh.runIgnoreExitCode("service opensearch status");
assertThat(status.exitCode, anyOf(equalTo(3), equalTo(4)));
}
@ -81,17 +81,17 @@ public class SysVInitTests extends PackagingTestCase {
// see https://github.com/elastic/elasticsearch/issues/11594
sh.run("rm -rf " + installation.pidDir);
startElasticsearch();
assertPathsExist(installation.pidDir.resolve("elasticsearch.pid"));
stopElasticsearch();
startOpenSearch();
assertPathsExist(installation.pidDir.resolve("opensearch.pid"));
stopOpenSearch();
}
public void test31MaxMapTooSmall() throws Exception {
sh.run("sysctl -q -w vm.max_map_count=262140");
startElasticsearch();
startOpenSearch();
Shell.Result result = sh.run("sysctl -n vm.max_map_count");
String maxMapCount = result.stdout.trim();
sh.run("service elasticsearch stop");
sh.run("service opensearch stop");
assertThat(maxMapCount, equalTo("262144"));
}
@ -99,10 +99,10 @@ public class SysVInitTests extends PackagingTestCase {
// Ensures that if $MAX_MAP_COUNT is greater than the set
// value on the OS we do not attempt to update it.
sh.run("sysctl -q -w vm.max_map_count=262145");
startElasticsearch();
startOpenSearch();
Shell.Result result = sh.run("sysctl -n vm.max_map_count");
String maxMapCount = result.stdout.trim();
sh.run("service elasticsearch stop");
sh.run("service opensearch stop");
assertThat(maxMapCount, equalTo("262145"));
}

View File

@ -43,8 +43,8 @@ import static org.hamcrest.CoreMatchers.equalTo;
public class WindowsServiceTests extends PackagingTestCase {
private static final String DEFAULT_ID = "elasticsearch-service-x64";
private static final String DEFAULT_DISPLAY_NAME = "Elasticsearch " + FileUtils.getCurrentVersion() + " (elasticsearch-service-x64)";
private static final String DEFAULT_ID = "opensearch-service-x64";
private static final String DEFAULT_DISPLAY_NAME = "OpenSearch " + FileUtils.getCurrentVersion() + " (opensearch-service-x64)";
private static String serviceScript;
@BeforeClass
@ -86,7 +86,7 @@ public class WindowsServiceTests extends PackagingTestCase {
Result logs = sh.run(
"$files = Get-ChildItem \""
+ installation.logs
+ "\\elasticsearch.log\"; "
+ "\\opensearch.log\"; "
+ "Write-Output $files; "
+ "foreach ($file in $files) {"
+ " Write-Output \"$file\"; "
@ -103,16 +103,16 @@ public class WindowsServiceTests extends PackagingTestCase {
public void test10InstallArchive() throws Exception {
installation = installArchive(sh, distribution());
verifyArchiveInstallation(installation, distribution());
serviceScript = installation.bin("elasticsearch-service.bat").toString();
serviceScript = installation.bin("opensearch-service.bat").toString();
}
public void test11InstallServiceExeMissing() throws IOException {
Path serviceExe = installation.bin("elasticsearch-service-x64.exe");
Path serviceExe = installation.bin("opensearch-service-x64.exe");
Path tmpServiceExe = serviceExe.getParent().resolve(serviceExe.getFileName() + ".tmp");
Files.move(serviceExe, tmpServiceExe);
Result result = sh.runIgnoreExitCode(serviceScript + " install");
assertThat(result.exitCode, equalTo(1));
assertThat(result.stdout, containsString("elasticsearch-service-x64.exe was not found..."));
assertThat(result.stdout, containsString("opensearch-service-x64.exe was not found..."));
Files.move(tmpServiceExe, serviceExe);
}
@ -155,7 +155,7 @@ public class WindowsServiceTests extends PackagingTestCase {
try {
mv(installation.bundledJdk, relocatedJdk);
Result result = sh.run(serviceScript + " install");
assertThat(result.stdout, containsString("The service 'elasticsearch-service-x64' has been installed."));
assertThat(result.stdout, containsString("The service 'opensearch-service-x64' has been installed."));
} finally {
sh.runIgnoreExitCode(serviceScript + " remove");
mv(relocatedJdk, installation.bundledJdk);
@ -163,7 +163,7 @@ public class WindowsServiceTests extends PackagingTestCase {
}
public void test20CustomizeServiceId() {
String serviceId = "my-es-service";
String serviceId = "my-opensearch-service";
String displayName = DEFAULT_DISPLAY_NAME.replace(DEFAULT_ID, serviceId);
sh.getEnv().put("SERVICE_ID", serviceId);
sh.run(serviceScript + " install");
@ -181,17 +181,17 @@ public class WindowsServiceTests extends PackagingTestCase {
// NOTE: service description is not attainable through any powershell api, so checking it is not possible...
public void assertStartedAndStop() throws Exception {
ServerUtils.waitForElasticsearch(installation);
ServerUtils.runElasticsearchTests();
ServerUtils.waitForOpenSearch(installation);
ServerUtils.runOpenSearchTests();
assertCommand(serviceScript + " stop");
assertService(DEFAULT_ID, "Stopped", DEFAULT_DISPLAY_NAME);
// the process is stopped async, and can become a zombie process, so we poll for the process actually being gone
assertCommand(
"$p = Get-Service -Name \"elasticsearch-service-x64\" -ErrorAction SilentlyContinue;"
"$p = Get-Service -Name \"opensearch-service-x64\" -ErrorAction SilentlyContinue;"
+ "$i = 0;"
+ "do {"
+ " $p = Get-Process -Name \"elasticsearch-service-x64\" -ErrorAction SilentlyContinue;"
+ " $p = Get-Process -Name \"opensearch-service-x64\" -ErrorAction SilentlyContinue;"
+ " echo \"$p\";"
+ " if ($p -eq $Null) {"
+ " Write-Host \"exited after $i seconds\";"
@ -205,7 +205,7 @@ public class WindowsServiceTests extends PackagingTestCase {
assertCommand(serviceScript + " remove");
assertCommand(
"$p = Get-Service -Name \"elasticsearch-service-x64\" -ErrorAction SilentlyContinue;"
"$p = Get-Service -Name \"opensearch-service-x64\" -ErrorAction SilentlyContinue;"
+ "echo \"$p\";"
+ "if ($p -eq $Null) {"
+ " exit 0;"
@ -249,10 +249,10 @@ public class WindowsServiceTests extends PackagingTestCase {
}
public void test60Manager() throws IOException {
Path serviceMgr = installation.bin("elasticsearch-service-mgr.exe");
Path serviceMgr = installation.bin("opensearch-service-mgr.exe");
Path tmpServiceMgr = serviceMgr.getParent().resolve(serviceMgr.getFileName() + ".tmp");
Files.move(serviceMgr, tmpServiceMgr);
Path fakeServiceMgr = serviceMgr.getParent().resolve("elasticsearch-service-mgr.bat");
Path fakeServiceMgr = serviceMgr.getParent().resolve("opensearch-service-mgr.bat");
Files.write(fakeServiceMgr, Arrays.asList("echo \"Fake Service Manager GUI\""));
Shell sh = new Shell();
Result result = sh.run(serviceScript + " manager");

View File

@ -61,9 +61,9 @@ public class Archives {
protected static final Logger logger = LogManager.getLogger(Archives.class);
// in the future we'll run as a role user on Windows
public static final String ARCHIVE_OWNER = Platforms.WINDOWS ? System.getenv("username") : "elasticsearch";
public static final String ARCHIVE_OWNER = Platforms.WINDOWS ? System.getenv("username") : "opensearch";
/** This is an arbitrarily chosen value that gives Elasticsearch time to log Bootstrap
/** This is an arbitrarily chosen value that gives OpenSearch time to log Bootstrap
* errors to the console if they occur before the logging framework is initialized. */
public static final String ES_STARTUP_SLEEP_TIME_SECONDS = "10";
@ -74,10 +74,10 @@ public class Archives {
public static Installation installArchive(Shell sh, Distribution distribution, Path fullInstallPath, String version) throws Exception {
final Path distributionFile = getDistributionFile(distribution);
final Path baseInstallPath = fullInstallPath.getParent();
final Path extractedPath = baseInstallPath.resolve("elasticsearch-" + version);
final Path extractedPath = baseInstallPath.resolve("opensearch-" + version);
assertThat("distribution file must exist: " + distributionFile.toString(), Files.exists(distributionFile), is(true));
assertThat("elasticsearch must not already be installed", lsGlob(baseInstallPath, "elasticsearch*"), empty());
assertThat("opensearch must not already be installed", lsGlob(baseInstallPath, "opensearch*"), empty());
logger.info("Installing file: " + distributionFile);
final String installCommand;
@ -108,7 +108,7 @@ public class Archives {
mv(extractedPath, fullInstallPath);
assertThat("extracted archive moved to install location", Files.exists(fullInstallPath));
final List<Path> installations = lsGlob(baseInstallPath, "elasticsearch*");
final List<Path> installations = lsGlob(baseInstallPath, "opensearch*");
assertThat("only the intended installation exists", installations, hasSize(1));
assertThat("only the intended installation exists", installations.get(0), is(fullInstallPath));
@ -122,35 +122,35 @@ public class Archives {
private static void setupArchiveUsersLinux(Path installPath) {
final Shell sh = new Shell();
if (sh.runIgnoreExitCode("getent group elasticsearch").isSuccess() == false) {
if (sh.runIgnoreExitCode("getent group opensearch").isSuccess() == false) {
if (isDPKG()) {
sh.run("addgroup --system elasticsearch");
sh.run("addgroup --system opensearch");
} else {
sh.run("groupadd -r elasticsearch");
sh.run("groupadd -r opensearch");
}
}
if (sh.runIgnoreExitCode("id elasticsearch").isSuccess() == false) {
if (sh.runIgnoreExitCode("id opensearch").isSuccess() == false) {
if (isDPKG()) {
sh.run(
"adduser "
+ "--quiet "
+ "--system "
+ "--no-create-home "
+ "--ingroup elasticsearch "
+ "--ingroup opensearch "
+ "--disabled-password "
+ "--shell /bin/false "
+ "elasticsearch"
+ "opensearch"
);
} else {
sh.run(
"useradd "
+ "--system "
+ "-M "
+ "--gid elasticsearch "
+ "--gid opensearch "
+ "--shell /sbin/nologin "
+ "--comment 'elasticsearch user' "
+ "elasticsearch"
+ "--comment 'opensearch user' "
+ "opensearch"
);
}
}
@ -167,15 +167,15 @@ public class Archives {
assertThat(es.bin, file(Directory, owner, owner, p755));
assertThat(es.lib, file(Directory, owner, owner, p755));
assertThat(Files.exists(es.config("elasticsearch.keystore")), is(false));
assertThat(Files.exists(es.config("opensearch.keystore")), is(false));
Stream.of(
"elasticsearch",
"elasticsearch-env",
"elasticsearch-keystore",
"elasticsearch-plugin",
"elasticsearch-shard",
"elasticsearch-node"
"opensearch",
"opensearch-env",
"opensearch-keystore",
"opensearch-plugin",
"opensearch-shard",
"opensearch-node"
).forEach(executable -> {
assertThat(es.bin(executable), file(File, owner, owner, p755));
@ -186,24 +186,24 @@ public class Archives {
});
if (distribution.packaging == Distribution.Packaging.ZIP) {
Stream.of("elasticsearch-service.bat", "elasticsearch-service-mgr.exe", "elasticsearch-service-x64.exe")
Stream.of("opensearch-service.bat", "opensearch-service-mgr.exe", "opensearch-service-x64.exe")
.forEach(executable -> assertThat(es.bin(executable), file(File, owner)));
}
Stream.of("elasticsearch.yml", "jvm.options", "log4j2.properties")
Stream.of("opensearch.yml", "jvm.options", "log4j2.properties")
.forEach(configFile -> assertThat(es.config(configFile), file(File, owner, owner, p660)));
Stream.of("NOTICE.txt", "LICENSE.txt", "README.asciidoc")
.forEach(doc -> assertThat(es.home.resolve(doc), file(File, owner, owner, p644)));
}
public static Shell.Result startElasticsearch(Installation installation, Shell sh) {
return runElasticsearchStartCommand(installation, sh, null, true);
public static Shell.Result startOpenSearch(Installation installation, Shell sh) {
return runOpenSearchStartCommand(installation, sh, null, true);
}
public static Shell.Result startElasticsearchWithTty(Installation installation, Shell sh, String keystorePassword, boolean daemonize)
public static Shell.Result startOpenSearchWithTty(Installation installation, Shell sh, String keystorePassword, boolean daemonize)
throws Exception {
final Path pidFile = installation.home.resolve("elasticsearch.pid");
final Path pidFile = installation.home.resolve("opensearch.pid");
final Installation.Executables bin = installation.executables();
List<String> command = new ArrayList<>();
@ -222,13 +222,13 @@ public class Archives {
+ "spawn -ignore HUP "
+ String.join(" ", command)
+ "\n"
+ "expect \"Elasticsearch keystore password:\"\n"
+ "expect \"OpenSearch keystore password:\"\n"
+ "send \"%s\\r\"\n"
+ "expect eof\n"
+ "EXPECT\n"
+ ")\"",
ARCHIVE_OWNER,
bin.elasticsearch,
bin.opensearch,
pidFile,
keystorePassword
);
@ -237,33 +237,33 @@ public class Archives {
return sh.runIgnoreExitCode(script);
}
public static Shell.Result runElasticsearchStartCommand(
public static Shell.Result runOpenSearchStartCommand(
Installation installation,
Shell sh,
String keystorePassword,
boolean daemonize
) {
final Path pidFile = installation.home.resolve("elasticsearch.pid");
final Path pidFile = installation.home.resolve("opensearch.pid");
assertThat(pidFile, fileDoesNotExist());
final Installation.Executables bin = installation.executables();
if (Platforms.WINDOWS == false) {
// If jayatana is installed then we try to use it. Elasticsearch should ignore it even when we try.
// If it doesn't ignore it then Elasticsearch will fail to start because of security errors.
// If jayatana is installed then we try to use it. OpenSearch should ignore it even when we try.
// If it doesn't ignore it then OpenSearch will fail to start because of security errors.
// This line is attempting to emulate the on login behavior of /usr/share/upstart/sessions/jayatana.conf
if (Files.exists(Paths.get("/usr/share/java/jayatanaag.jar"))) {
sh.getEnv().put("JAVA_TOOL_OPTIONS", "-javaagent:/usr/share/java/jayatanaag.jar");
}
// We need to give Elasticsearch enough time to print failures to stderr before exiting
// We need to give OpenSearch enough time to print failures to stderr before exiting
sh.getEnv().put("ES_STARTUP_SLEEP_TIME", ES_STARTUP_SLEEP_TIME_SECONDS);
List<String> command = new ArrayList<>();
command.add("sudo -E -u ");
command.add(ARCHIVE_OWNER);
command.add(bin.elasticsearch.toString());
command.add(bin.opensearch.toString());
if (daemonize) {
command.add("-d");
}
@ -294,10 +294,10 @@ public class Archives {
return sh.run(
"$processInfo = New-Object System.Diagnostics.ProcessStartInfo; "
+ "$processInfo.FileName = '"
+ bin.elasticsearch
+ bin.opensearch
+ "'; "
+ "$processInfo.Arguments = '-p "
+ installation.home.resolve("elasticsearch.pid")
+ installation.home.resolve("opensearch.pid")
+ "'; "
+ powerShellProcessUserSetup
+ "$processInfo.RedirectStandardOutput = $true; "
@ -341,24 +341,24 @@ public class Archives {
if (keystorePassword != null) {
command.add("echo '" + keystorePassword + "' |");
}
command.add(bin.elasticsearch.toString());
command.add(bin.opensearch.toString());
command.add("-p");
command.add(installation.home.resolve("elasticsearch.pid").toString());
command.add(installation.home.resolve("opensearch.pid").toString());
return sh.runIgnoreExitCode(String.join(" ", command));
}
}
public static void assertElasticsearchStarted(Installation installation) throws Exception {
final Path pidFile = installation.home.resolve("elasticsearch.pid");
ServerUtils.waitForElasticsearch(installation);
public static void assertOpenSearchStarted(Installation installation) throws Exception {
final Path pidFile = installation.home.resolve("opensearch.pid");
ServerUtils.waitForOpenSearch(installation);
assertThat("Starting Elasticsearch produced a pid file at " + pidFile, pidFile, fileExists());
assertThat("Starting OpenSearch produced a pid file at " + pidFile, pidFile, fileExists());
String pid = slurp(pidFile).trim();
assertThat(pid, is(not(emptyOrNullString())));
}
public static void stopElasticsearch(Installation installation) throws Exception {
Path pidFile = installation.home.resolve("elasticsearch.pid");
public static void stopOpenSearch(Installation installation) throws Exception {
Path pidFile = installation.home.resolve("opensearch.pid");
assertThat(pidFile, fileExists());
String pid = slurp(pidFile).trim();
assertThat(pid, is(not(emptyOrNullString())));

View File

@ -36,8 +36,8 @@ import static org.opensearch.packaging.util.Platforms.isSystemd;
public class Cleanup {
private static final List<String> ELASTICSEARCH_FILES_LINUX = Arrays.asList(
"/usr/share/elasticsearch",
"/etc/elasticsearch/elasticsearch.keystore",
"/usr/share/opensearch",
"/etc/elasticsearch/opensearch.keystore",
"/etc/elasticsearch",
"/var/lib/elasticsearch",
"/var/log/elasticsearch",
@ -103,11 +103,11 @@ public class Cleanup {
// Doing rpm erase on both packages in one command will remove neither since both cannot be installed
// this may leave behind config files in /etc/elasticsearch, but a later step in this cleanup will get them
sh.runIgnoreExitCode("rpm --quiet -e elasticsearch");
sh.runIgnoreExitCode("rpm --quiet -e elasticsearch-oss");
sh.runIgnoreExitCode("rpm --quiet -e opensearch-oss");
}
if (isDPKG()) {
sh.runIgnoreExitCode("dpkg --purge elasticsearch elasticsearch-oss");
sh.runIgnoreExitCode("dpkg --purge elasticsearch opensearch-oss");
}
}
}

View File

@ -127,7 +127,7 @@ public class Docker {
) {
executeDockerRun(distribution, volumes, envVars, uid, gid);
waitForElasticsearchToStart();
waitForOpenSearchToStart();
return Installation.ofContainer(dockerShell, distribution);
}
@ -148,7 +148,7 @@ public class Docker {
) {
executeDockerRun(distribution, volumes, envVars, null, null);
waitForElasticsearchToExit();
waitForOpenSearchToExit();
return getContainerLogs();
}
@ -222,8 +222,8 @@ public class Docker {
* Waits for the Elasticsearch process to start executing in the container.
* This is called every time a container is started.
*/
public static void waitForElasticsearchToStart() {
boolean isElasticsearchRunning = false;
public static void waitForOpenSearchToStart() {
boolean isOpenSearchRunning = false;
int attempt = 0;
String psOutput = null;
@ -236,7 +236,7 @@ public class Docker {
psOutput = dockerShell.run("ps -ww ax").stdout;
if (psOutput.contains("org.opensearch.bootstrap.Elasticsearch")) {
isElasticsearchRunning = true;
isOpenSearchRunning = true;
break;
}
} catch (Exception e) {
@ -244,7 +244,7 @@ public class Docker {
}
} while (attempt++ < STARTUP_ATTEMPTS_MAX);
if (isElasticsearchRunning == false) {
if (isOpenSearchRunning == false) {
final Shell.Result dockerLogs = getContainerLogs();
fail(
"Elasticsearch container did not start successfully.\n\nps output:\n"
@ -260,8 +260,8 @@ public class Docker {
/**
* Waits for the Elasticsearch container to exit.
*/
private static void waitForElasticsearchToExit() {
boolean isElasticsearchRunning = true;
private static void waitForOpenSearchToExit() {
boolean isOpenSearchRunning = true;
int attempt = 0;
do {
@ -270,7 +270,7 @@ public class Docker {
Thread.sleep(1000);
if (sh.run("docker ps --quiet --no-trunc").stdout.contains(containerId) == false) {
isElasticsearchRunning = false;
isOpenSearchRunning = false;
break;
}
} catch (Exception e) {
@ -278,7 +278,7 @@ public class Docker {
}
} while (attempt++ < 5);
if (isElasticsearchRunning) {
if (isOpenSearchRunning) {
final Shell.Result dockerLogs = getContainerLogs();
fail("Elasticsearch container did exit.\n\nStdout:\n" + dockerLogs.stdout + "\n\nStderr:\n" + dockerLogs.stderr);
}
@ -492,27 +492,27 @@ public class Docker {
final Shell.Result passwdResult = dockerShell.run("getent passwd elasticsearch");
final String homeDir = passwdResult.stdout.trim().split(":")[5];
assertThat(homeDir, equalTo("/usr/share/elasticsearch"));
assertThat(homeDir, equalTo("/usr/share/opensearch"));
Stream.of(es.home, es.data, es.logs, es.config).forEach(dir -> assertPermissionsAndOwnership(dir, p775));
Stream.of(es.plugins, es.modules).forEach(dir -> assertPermissionsAndOwnership(dir, p755));
Stream.of("elasticsearch.keystore", "elasticsearch.yml", "jvm.options", "log4j2.properties")
Stream.of("opensearch.keystore", "opensearch.yml", "jvm.options", "log4j2.properties")
.forEach(configFile -> assertPermissionsAndOwnership(es.config(configFile), p660));
assertThat(dockerShell.run(es.bin("elasticsearch-keystore") + " list").stdout, containsString("keystore.seed"));
assertThat(dockerShell.run(es.bin("opensearch-keystore") + " list").stdout, containsString("keystore.seed"));
Stream.of(es.bin, es.lib).forEach(dir -> assertPermissionsAndOwnership(dir, p755));
Stream.of(
"elasticsearch",
"elasticsearch-cli",
"elasticsearch-env",
"elasticsearch-keystore",
"elasticsearch-node",
"elasticsearch-plugin",
"elasticsearch-shard"
"opensearch",
"opensearch-cli",
"opensearch-env",
"opensearch-keystore",
"opensearch-shard",
"opensearch-plugin",
"opensearch-node"
).forEach(executable -> assertPermissionsAndOwnership(es.bin(executable), p755));
Stream.of("LICENSE.txt", "NOTICE.txt", "README.asciidoc").forEach(doc -> assertPermissionsAndOwnership(es.home.resolve(doc), p644));
@ -526,13 +526,13 @@ public class Docker {
});
}
public static void waitForElasticsearch(Installation installation) throws Exception {
withLogging(() -> ServerUtils.waitForElasticsearch(installation));
public static void waitForOpenSearch(Installation installation) throws Exception {
withLogging(() -> ServerUtils.waitForOpenSearch(installation));
}
public static void waitForElasticsearch(String status, String index, Installation installation, String username, String password)
public static void waitForOpenSearch(String status, String index, Installation installation, String username, String password)
throws Exception {
withLogging(() -> ServerUtils.waitForElasticsearch(status, index, installation, username, password));
withLogging(() -> ServerUtils.waitForOpenSearch(status, index, installation, username, password));
}
/**

View File

@ -23,12 +23,12 @@ import java.nio.file.Path;
import java.nio.file.Paths;
/**
* Represents an installation of Elasticsearch
* Represents an installation of OpenSearch
*/
public class Installation {
// in the future we'll run as a role user on Windows
public static final String ARCHIVE_OWNER = Platforms.WINDOWS ? System.getenv("username") : "elasticsearch";
public static final String ARCHIVE_OWNER = Platforms.WINDOWS ? System.getenv("username") : "opensearch";
private final Shell sh;
public final Distribution distribution;
@ -89,25 +89,25 @@ public class Installation {
public static Installation ofPackage(Shell sh, Distribution distribution) {
final Path envFile = (distribution.packaging == Distribution.Packaging.RPM)
? Paths.get("/etc/sysconfig/elasticsearch")
: Paths.get("/etc/default/elasticsearch");
? Paths.get("/etc/sysconfig/opensearch")
: Paths.get("/etc/default/opensearch");
return new Installation(
sh,
distribution,
Paths.get("/usr/share/elasticsearch"),
Paths.get("/etc/elasticsearch"),
Paths.get("/var/lib/elasticsearch"),
Paths.get("/var/log/elasticsearch"),
Paths.get("/usr/share/elasticsearch/plugins"),
Paths.get("/usr/share/elasticsearch/modules"),
Paths.get("/var/run/elasticsearch"),
Paths.get("/usr/share/opensearch"),
Paths.get("/etc/opensearch"),
Paths.get("/var/lib/opensearch"),
Paths.get("/var/log/opensearch"),
Paths.get("/usr/share/opensearch/plugins"),
Paths.get("/usr/share/opensearch/modules"),
Paths.get("/var/run/opensearch"),
envFile
);
}
public static Installation ofContainer(Shell sh, Distribution distribution) {
String root = "/usr/share/elasticsearch";
String root = "/usr/share/opensearch";
return new Installation(
sh,
distribution,
@ -188,10 +188,10 @@ public class Installation {
public class Executables {
public final Executable elasticsearch = new Executable("elasticsearch");
public final Executable pluginTool = new Executable("elasticsearch-plugin");
public final Executable keystoreTool = new Executable("elasticsearch-keystore");
public final Executable shardTool = new Executable("elasticsearch-shard");
public final Executable nodeTool = new Executable("elasticsearch-node");
public final Executable elasticsearch = new Executable("opensearch");
public final Executable pluginTool = new Executable("opensearch-plugin");
public final Executable keystoreTool = new Executable("opensearch-keystore");
public final Executable shardTool = new Executable("opensearch-shard");
public final Executable nodeTool = new Executable("opensearch-node");
}
}

View File

@ -43,7 +43,7 @@ import static org.opensearch.packaging.util.FileMatcher.p750;
import static org.opensearch.packaging.util.FileMatcher.p755;
import static org.opensearch.packaging.util.Platforms.isSysVInit;
import static org.opensearch.packaging.util.Platforms.isSystemd;
import static org.opensearch.packaging.util.ServerUtils.waitForElasticsearch;
import static org.opensearch.packaging.util.ServerUtils.waitForOpenSearch;
import static org.hamcrest.CoreMatchers.anyOf;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.is;
@ -56,7 +56,7 @@ public class Packages {
private static final Logger logger = LogManager.getLogger(Packages.class);
public static final Path SYSVINIT_SCRIPT = Paths.get("/etc/init.d/elasticsearch");
public static final Path SYSTEMD_SERVICE = Paths.get("/usr/lib/systemd/system/elasticsearch.service");
public static final Path SYSTEMD_SERVICE = Paths.get("/usr/lib/systemd/system/opensearch.service");
public static void assertInstalled(Distribution distribution) throws Exception {
final Result status = packageStatus(distribution);
@ -184,15 +184,15 @@ public class Packages {
assertThat(jvmOptionsDirectory, file(Directory, "root", "elasticsearch", p750));
assertThat(sh.run("find \"" + jvmOptionsDirectory + "\" -maxdepth 0 -printf \"%m\"").stdout, containsString("2750"));
Stream.of("elasticsearch.keystore", "elasticsearch.yml", "jvm.options", "log4j2.properties")
Stream.of("opensearch.keystore", "opensearch.yml", "jvm.options", "log4j2.properties")
.forEach(configFile -> assertThat(es.config(configFile), file(File, "root", "elasticsearch", p660)));
assertThat(es.config(".elasticsearch.keystore.initial_md5sum"), file(File, "root", "elasticsearch", p644));
assertThat(es.config(".opensearch.keystore.initial_md5sum"), file(File, "root", "elasticsearch", p644));
assertThat(sh.run("sudo -u elasticsearch " + es.bin("elasticsearch-keystore") + " list").stdout, containsString("keystore.seed"));
assertThat(sh.run("sudo -u elasticsearch " + es.bin("opensearch-keystore") + " list").stdout, containsString("keystore.seed"));
Stream.of(es.bin, es.lib).forEach(dir -> assertThat(dir, file(Directory, "root", "root", p755)));
Stream.of("elasticsearch", "elasticsearch-plugin", "elasticsearch-keystore", "elasticsearch-shard", "elasticsearch-node")
Stream.of("elasticsearch", "opensearch-plugin", "opensearch-keystore", "opensearch-shard", "opensearch-shard")
.forEach(executable -> assertThat(es.bin(executable), file(File, "root", "root", p755)));
Stream.of("NOTICE.txt", "README.asciidoc").forEach(doc -> assertThat(es.home.resolve(doc), file(File, "root", "root", p644)));
@ -226,40 +226,40 @@ public class Packages {
/**
* Starts Elasticsearch, without checking that startup is successful.
*/
public static Shell.Result runElasticsearchStartCommand(Shell sh) throws IOException {
public static Shell.Result runOpenSearchStartCommand(Shell sh) throws IOException {
if (isSystemd()) {
sh.run("systemctl daemon-reload");
sh.run("systemctl enable elasticsearch.service");
sh.run("systemctl is-enabled elasticsearch.service");
return sh.runIgnoreExitCode("systemctl start elasticsearch.service");
sh.run("systemctl enable opensearch.service");
sh.run("systemctl is-enabled opensearch.service");
return sh.runIgnoreExitCode("systemctl start opensearch.service");
}
return sh.runIgnoreExitCode("service elasticsearch start");
return sh.runIgnoreExitCode("service opensearch start");
}
public static void assertElasticsearchStarted(Shell sh, Installation installation) throws Exception {
waitForElasticsearch(installation);
waitForOpenSearch(installation);
if (isSystemd()) {
sh.run("systemctl is-active elasticsearch.service");
sh.run("systemctl status elasticsearch.service");
sh.run("systemctl is-active opensearch.service");
sh.run("systemctl status opensearch.service");
} else {
sh.run("service elasticsearch status");
sh.run("service opensearch status");
}
}
public static void stopElasticsearch(Shell sh) {
public static void stopOpenSearch(Shell sh) {
if (isSystemd()) {
sh.run("systemctl stop elasticsearch.service");
sh.run("systemctl stop opensearch.service");
} else {
sh.run("service elasticsearch stop");
sh.run("service opensearch stop");
}
}
public static void restartElasticsearch(Shell sh, Installation installation) throws Exception {
public static void restartOpenSearch(Shell sh, Installation installation) throws Exception {
if (isSystemd()) {
sh.run("systemctl restart elasticsearch.service");
sh.run("systemctl restart opensearch.service");
} else {
sh.run("service elasticsearch restart");
sh.run("service opensearch restart");
}
assertElasticsearchStarted(sh, installation);
}
@ -288,7 +288,7 @@ public class Packages {
* for Elasticsearch logs and storing it in class state.
*/
public void clear() {
final String script = "sudo journalctl --unit=elasticsearch.service --lines=0 --show-cursor -o cat | sed -e 's/-- cursor: //'";
final String script = "sudo journalctl --unit=opensearch.service --lines=0 --show-cursor -o cat | sed -e 's/-- cursor: //'";
cursor = sh.run(script).stdout.trim();
}
@ -297,7 +297,7 @@ public class Packages {
* @return Recent journald logs for the Elasticsearch service.
*/
public Result getLogs() {
return sh.run("journalctl -u elasticsearch.service --after-cursor='" + this.cursor + "'");
return sh.run("journalctl -u opensearch.service --after-cursor='" + this.cursor + "'");
}
}

View File

@ -61,8 +61,8 @@ public class ServerUtils {
private static final long timeoutLength = TimeUnit.SECONDS.toMillis(30);
private static final long requestInterval = TimeUnit.SECONDS.toMillis(5);
public static void waitForElasticsearch(Installation installation) throws Exception {
waitForElasticsearch("green", null, installation, null, null);
public static void waitForOpenSearch(Installation installation) throws Exception {
waitForOpenSearch("green", null, installation, null, null);
}
/**
@ -112,7 +112,7 @@ public class ServerUtils {
return executor.execute(request).returnResponse();
}
public static void waitForElasticsearch(String status, String index, Installation installation, String username, String password)
public static void waitForOpenSearch(String status, String index, Installation installation, String username, String password)
throws Exception {
Objects.requireNonNull(status);
@ -145,7 +145,7 @@ public class ServerUtils {
if (response.getStatusLine().getStatusCode() >= 300) {
final String statusLine = response.getStatusLine().toString();
final String body = EntityUtils.toString(response.getEntity());
throw new RuntimeException("Connecting to elasticsearch cluster health API failed:\n" + statusLine + "\n" + body);
throw new RuntimeException("Connecting to opensearch cluster health API failed:\n" + statusLine + "\n" + body);
}
started = true;
@ -169,7 +169,7 @@ public class ServerUtils {
FileUtils.logAllLogs(installation.logs, logger);
}
throw new RuntimeException("Elasticsearch did not start", thrownException);
throw new RuntimeException("OpenSearch did not start", thrownException);
}
final String url;
@ -183,7 +183,7 @@ public class ServerUtils {
assertThat("cluster health response must contain desired status", body, containsString(status));
}
public static void runElasticsearchTests() throws Exception {
public static void runOpenSearchTests() throws Exception {
makeRequest(
Request.Post("http://localhost:9200/library/book/1?refresh=true&pretty")
.bodyString("{ \"title\": \"Book #1\", \"pages\": 123 }", ContentType.APPLICATION_JSON)

View File

@ -1,4 +1,4 @@
import org.elasticsearch.gradle.test.GradleDistroTestTask
import org.opensearch.gradle.test.GradleDistroTestTask
String boxId = project.properties.get('vagrant.windows-2012r2.id')
if (boxId != null) {

View File

@ -1,4 +1,4 @@
import org.elasticsearch.gradle.test.GradleDistroTestTask
import org.opensearch.gradle.test.GradleDistroTestTask
String boxId = project.properties.get('vagrant.windows-2016.id')
if (boxId != null) {

View File

@ -17,13 +17,13 @@
* under the License.
*/
import org.elasticsearch.gradle.Architecture
import org.elasticsearch.gradle.VersionProperties
import org.elasticsearch.gradle.testfixtures.TestFixturesPlugin
import org.opensearch.gradle.Architecture
import org.opensearch.gradle.VersionProperties
import org.opensearch.gradle.testfixtures.TestFixturesPlugin
apply plugin: 'elasticsearch.standalone-rest-test'
apply plugin: 'elasticsearch.test.fixtures'
apply plugin: 'elasticsearch.internal-distribution-download'
apply plugin: 'opensearch.standalone-rest-test'
apply plugin: 'opensearch.test.fixtures'
apply plugin: 'opensearch.internal-distribution-download'
testFixtures.useFixture()

View File

@ -1,24 +1,24 @@
# Only used for testing the docker images
version: '3.7'
services:
elasticsearch-oss-1:
image: elasticsearch:test
opensearch-oss-1:
image: opensearch:test
environment:
- node.name=elasticsearch-oss-1
- cluster.initial_master_nodes=elasticsearch-oss-1
- cluster.name=elasticsearch-oss-1
- node.name=opensearch-oss-1
- cluster.initial_master_nodes=opensearch-oss-1
- cluster.name=opensearch-oss-1
- bootstrap.memory_lock=true
- network.publish_host=127.0.0.1
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- path.repo=/tmp/es-repo
- path.repo=/tmp/opensearch-repo
- node.attr.testattr=test
- cluster.routing.allocation.disk.watermark.low=1b
- cluster.routing.allocation.disk.watermark.high=1b
- cluster.routing.allocation.disk.watermark.flood_stage=1b
- node.store.allow_mmap=false
volumes:
- ./build/oss-repo:/tmp/es-repo
- ./build/logs/oss-1:/usr/share/elasticsearch/logs
- ./build/oss-repo:/tmp/opensearch-repo
- ./build/logs/oss-1:/usr/share/opensearch/logs
ports:
- "9200"
- "9300"
@ -35,24 +35,24 @@ services:
interval: 10s
timeout: 2s
retries: 5
elasticsearch-oss-2:
image: elasticsearch:test
opensearch-oss-2:
image: opensearch:test
environment:
- node.name=elasticsearch-oss-2
- cluster.initial_master_nodes=elasticsearch-oss-2
- cluster.name=elasticsearch-oss-2
- node.name=opensearch-oss-2
- cluster.initial_master_nodes=opensearch-oss-2
- cluster.name=opensearch-oss-2
- bootstrap.memory_lock=true
- network.publish_host=127.0.0.1
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- path.repo=/tmp/es-repo
- path.repo=/tmp/opensearch-repo
- node.attr.testattr=test
- cluster.routing.allocation.disk.watermark.low=1b
- cluster.routing.allocation.disk.watermark.high=1b
- cluster.routing.allocation.disk.watermark.flood_stage=1b
- node.store.allow_mmap=false
volumes:
- ./build/oss-repo:/tmp/es-repo
- ./build/logs/oss-2:/usr/share/elasticsearch/logs
- ./build/oss-repo:/tmp/opensearch-repo
- ./build/logs/oss-2:/usr/share/opensearch/logs
ports:
- "9200"
- "9300"

View File

@ -1,25 +1,25 @@
# Only used for testing the docker images
version: '3.7'
services:
elasticsearch-default-1:
image: elasticsearch:test
opensearch-default-1:
image: opensearch:test
environment:
- node.name=elasticsearch-default-1
- cluster.initial_master_nodes=elasticsearch-default-1
- cluster.name=elasticsearch-default-1
- node.name=opensearch-default-1
- cluster.initial_master_nodes=opensearch-default-1
- cluster.name=opensearch-default-1
- bootstrap.memory_lock=true
- network.publish_host=127.0.0.1
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- path.repo=/tmp/es-repo
- path.repo=/tmp/opensearch-repo
- node.attr.testattr=test
- cluster.routing.allocation.disk.watermark.low=1b
- cluster.routing.allocation.disk.watermark.high=1b
- cluster.routing.allocation.disk.watermark.flood_stage=1b
- node.store.allow_mmap=false
volumes:
- ./build/repo:/tmp/es-repo
- ./build/certs/testnode.jks:/usr/share/elasticsearch/config/testnode.jks
- ./build/logs/default-1:/usr/share/elasticsearch/logs
- ./build/repo:/tmp/opensearch-repo
- ./build/certs/testnode.jks:/usr/share/opensearch/config/testnode.jks
- ./build/logs/default-1:/usr/share/opensearch/logs
- ./docker-test-entrypoint.sh:/docker-test-entrypoint.sh
ports:
- "9200"
@ -38,25 +38,25 @@ services:
interval: 10s
timeout: 2s
retries: 5
elasticsearch-default-2:
image: elasticsearch:test
opensearch-default-2:
image: opensearch:test
environment:
- node.name=elasticsearch-default-2
- cluster.initial_master_nodes=elasticsearch-default-2
- cluster.name=elasticsearch-default-2
- node.name=opensearch-default-2
- cluster.initial_master_nodes=opensearch-default-2
- cluster.name=opensearch-default-2
- bootstrap.memory_lock=true
- network.publish_host=127.0.0.1
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- path.repo=/tmp/es-repo
- path.repo=/tmp/opensearch-repo
- node.attr.testattr=test
- cluster.routing.allocation.disk.watermark.low=1b
- cluster.routing.allocation.disk.watermark.high=1b
- cluster.routing.allocation.disk.watermark.flood_stage=1b
- node.store.allow_mmap=false
volumes:
- ./build/repo:/tmp/es-repo
- ./build/certs/testnode.jks:/usr/share/elasticsearch/config/testnode.jks
- ./build/logs/default-2:/usr/share/elasticsearch/logs
- ./build/repo:/tmp/opensearch-repo
- ./build/certs/testnode.jks:/usr/share/opensearch/config/testnode.jks
- ./build/logs/default-2:/usr/share/opensearch/logs
- ./docker-test-entrypoint.sh:/docker-test-entrypoint.sh
ports:
- "9200"

View File

@ -1,5 +1,5 @@
#!/bin/bash
cd /usr/share/elasticsearch/bin/
cd /usr/share/opensearch/bin/
./elasticsearch-users useradd rest_user -p test-password -r superuser || true
echo "testnode" > /tmp/password
/usr/local/bin/docker-entrypoint.sh | tee > /usr/share/elasticsearch/logs/console.log
/usr/local/bin/docker-entrypoint.sh | tee > /usr/share/opensearch/logs/console.log

View File

@ -21,7 +21,7 @@ frontend ft_ssl
backend bk_ssl
use-server server1 if { req_ssl_sni -i application1.example.com }
server server1 elasticsearch-default-1:9300 weight 0 check
server server1 opensearch-default-1:9300 weight 0 check
use-server server2 if { req_ssl_sni -i application2.example.com }
server server2 elasticsearch-default-2:9300 weight 0 check
server default elasticsearch-default-2:9300 check
server server2 opensearch-default-2:9300 weight 0 check
server default opensearch-default-2:9300 check

View File

@ -18,4 +18,4 @@ frontend ft_reg
default_backend bk_reg
backend bk_reg
server default elasticsearch-oss-2:9300 check
server default opensearch-oss-2:9300 check

View File

@ -27,7 +27,7 @@ import org.opensearch.client.RestHighLevelClient;
import org.opensearch.common.io.PathUtils;
import org.opensearch.common.settings.Settings;
import org.opensearch.core.internal.io.IOUtils;
import org.opensearch.test.rest.ESRestTestCase;
import org.opensearch.test.rest.OpenSearchRestTestCase;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
@ -38,7 +38,7 @@ import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Collections;
public abstract class AbstractMultiClusterRemoteTestCase extends ESRestTestCase {
public abstract class AbstractMultiClusterRemoteTestCase extends OpenSearchRestTestCase {
@Override
protected boolean preserveClusterUponCompletion() {
@ -52,7 +52,7 @@ public abstract class AbstractMultiClusterRemoteTestCase extends ESRestTestCase
@Override
protected String getTestRestCluster() {
return "localhost:" + getProperty("test.fixtures.elasticsearch-oss-1.tcp.9200");
return "localhost:" + getProperty("test.fixtures.opensearch-oss-1.tcp.9200");
}
@Before
@ -61,8 +61,8 @@ public abstract class AbstractMultiClusterRemoteTestCase extends ESRestTestCase
return;
}
cluster1Client = buildClient("localhost:" + getProperty("test.fixtures.elasticsearch-oss-1.tcp.9200"));
cluster2Client = buildClient("localhost:" + getProperty("test.fixtures.elasticsearch-oss-2.tcp.9200"));
cluster1Client = buildClient("localhost:" + getProperty("test.fixtures.opensearch-oss-1.tcp.9200"));
cluster2Client = buildClient("localhost:" + getProperty("test.fixtures.opensearch-oss-2.tcp.9200"));
cluster1Client().cluster().health(new ClusterHealthRequest().waitForNodes("1").waitForYellowStatus(), RequestOptions.DEFAULT);
cluster2Client().cluster().health(new ClusterHealthRequest().waitForNodes("1").waitForYellowStatus(), RequestOptions.DEFAULT);
@ -135,7 +135,7 @@ public abstract class AbstractMultiClusterRemoteTestCase extends ESRestTestCase
String value = System.getProperty(key);
if (value == null) {
throw new IllegalStateException("Could not find system properties from test.fixtures. " +
"This test expects to run with the elasticsearch.test.fixtures Gradle plugin");
"This test expects to run with the opensearch.test.fixtures Gradle plugin");
}
return value;
}

View File

@ -68,7 +68,7 @@ public class RemoteClustersIT extends AbstractMultiClusterRemoteTestCase {
}
public void testProxyModeConnectionWorks() throws IOException {
String cluster2RemoteClusterSeed = "elasticsearch-oss-2:9300";
String cluster2RemoteClusterSeed = "opensearch-oss-2:9300";
logger.info("Configuring remote cluster [{}]", cluster2RemoteClusterSeed);
ClusterUpdateSettingsRequest request = new ClusterUpdateSettingsRequest().persistentSettings(Settings.builder()
.put("cluster.remote.cluster2.mode", "proxy")
@ -85,7 +85,7 @@ public class RemoteClustersIT extends AbstractMultiClusterRemoteTestCase {
}
public void testSniffModeConnectionFails() throws IOException {
String cluster2RemoteClusterSeed = "elasticsearch-oss-2:9300";
String cluster2RemoteClusterSeed = "opensearch-oss-2:9300";
logger.info("Configuring remote cluster [{}]", cluster2RemoteClusterSeed);
ClusterUpdateSettingsRequest request = new ClusterUpdateSettingsRequest().persistentSettings(Settings.builder()
.put("cluster.remote.cluster2alt.mode", "sniff")

View File

@ -17,12 +17,12 @@
* under the License.
*/
import org.elasticsearch.gradle.Version
import org.elasticsearch.gradle.info.BuildParams
import org.elasticsearch.gradle.testclusters.StandaloneRestIntegTestTask
import org.opensearch.gradle.Version
import org.opensearch.gradle.info.BuildParams
import org.opensearch.gradle.testclusters.StandaloneRestIntegTestTask
apply plugin: 'elasticsearch.testclusters'
apply plugin: 'elasticsearch.standalone-test'
apply plugin: 'opensearch.testclusters'
apply plugin: 'opensearch.standalone-test'
apply from : "$rootDir/gradle/bwc-test.gradle"
dependencies {

View File

@ -37,7 +37,7 @@ import org.opensearch.common.xcontent.DeprecationHandler;
import org.opensearch.common.xcontent.XContentParser;
import org.opensearch.common.xcontent.json.JsonXContent;
import org.opensearch.snapshots.SnapshotsService;
import org.opensearch.test.rest.ESRestTestCase;
import org.opensearch.test.rest.OpenSearchRestTestCase;
import java.io.IOException;
import java.io.InputStream;
@ -61,7 +61,7 @@ import static org.hamcrest.Matchers.is;
* <li>Run against the current version cluster from the second step: {@link TestStep#STEP4_NEW_CLUSTER}</li>
* </ul>
*/
public class MultiVersionRepositoryAccessIT extends ESRestTestCase {
public class MultiVersionRepositoryAccessIT extends OpenSearchRestTestCase {
private enum TestStep {
STEP1_OLD_CLUSTER("step1"),

Some files were not shown because too many files have changed in this diff Show More