[Rename] remaining elasticsearch pass 1 (#416)

This commit refactors instances of 'elasticsearch' with opensearch everywhere
except references to issues, and other places needed to test compatibility with
old elasticsearch clusters.

Signed-off-by: Nicholas Walter Knize <nknize@apache.org>
This commit is contained in:
Nick Knize 2021-03-19 16:41:43 -05:00 committed by Nick Knize
parent 2830b3442f
commit 7051167c83
49 changed files with 157 additions and 242 deletions

View File

@ -520,17 +520,6 @@ public class OpenSearchNode implements TestClusterConfiguration {
installModules();
if (credentials.isEmpty() == false) {
logToProcessStdout("Setting up " + credentials.size() + " users");
credentials.forEach(
paramMap -> runOpenSearchBinScript(
getVersion().onOrAfter("6.3.0") ? "elasticsearch-users" : "x-pack/users",
paramMap.entrySet().stream().flatMap(entry -> Stream.of(entry.getKey(), entry.getValue())).toArray(String[]::new)
)
);
}
if (cliSetup.isEmpty() == false) {
logToProcessStdout("Running " + cliSetup.size() + " setup commands");
@ -673,20 +662,7 @@ public class OpenSearchNode implements TestClusterConfiguration {
}
@Override
public void user(Map<String, String> userSpec) {
// Set<String> keys = new HashSet<>(userSpec.keySet());
// keys.remove("username");
// keys.remove("password");
// keys.remove("role");
// if (keys.isEmpty() == false) {
// throw new TestClustersException("Unknown keys in user definition " + keys + " for " + this);
// }
// Map<String, String> cred = new LinkedHashMap<>();
// cred.put("useradd", userSpec.getOrDefault("username", "test_user"));
// cred.put("-p", userSpec.getOrDefault("password", "x-pack-test-password"));
// cred.put("-r", userSpec.getOrDefault("role", "superuser"));
// credentials.add(cred);
}
public void user(Map<String, String> userSpec) {}
private void runOpenSearchBinScriptWithInput(String input, String tool, CharSequence... args) {
if (Files.exists(getDistroDir().resolve("bin").resolve(tool)) == false

View File

@ -127,7 +127,7 @@ public class QueryDSLDocumentationTests extends OpenSearchTestCase {
// tag::dis_max
disMaxQuery()
.add(termQuery("name", "kimchy")) // <1>
.add(termQuery("name", "elasticsearch")) // <2>
.add(termQuery("name", "opensearch")) // <2>
.boost(1.2f) // <3>
.tieBreaker(0.7f); // <4>
// end::dis_max
@ -251,7 +251,7 @@ public class QueryDSLDocumentationTests extends OpenSearchTestCase {
// tag::match
matchQuery(
"name", // <1>
"kimchy elasticsearch"); // <2>
"kimchy opensearch"); // <2>
// end::match
}
@ -269,7 +269,7 @@ public class QueryDSLDocumentationTests extends OpenSearchTestCase {
public void testMultiMatch() {
// tag::multi_match
multiMatchQuery(
"kimchy elasticsearch", // <1>
"kimchy opensearch", // <1>
"user", "message"); // <2>
// end::multi_match
}
@ -295,7 +295,7 @@ public class QueryDSLDocumentationTests extends OpenSearchTestCase {
public void testQueryString() {
// tag::query_string
queryStringQuery("+kimchy -elasticsearch");
queryStringQuery("+kimchy -opensearch");
// end::query_string
}
@ -344,7 +344,7 @@ public class QueryDSLDocumentationTests extends OpenSearchTestCase {
public void testSimpleQueryString() {
// tag::simple_query_string
simpleQueryStringQuery("+kimchy -elasticsearch");
simpleQueryStringQuery("+kimchy -opensearch");
// end::simple_query_string
}

View File

@ -845,7 +845,7 @@ public class SearchDocumentationIT extends OpenSearchRestHighLevelClientTestCase
RestHighLevelClient client = highLevelClient();
// tag::multi-search-template-request-inline
String [] searchTerms = {"elasticsearch", "logstash", "kibana"};
String [] searchTerms = {"opensearch", "opensearch-dashboards"};
MultiSearchTemplateRequest multiRequest = new MultiSearchTemplateRequest(); // <1>
for (String searchTerm : searchTerms) {
@ -903,7 +903,7 @@ public class SearchDocumentationIT extends OpenSearchRestHighLevelClientTestCase
// tag::multi-search-template-request-stored
MultiSearchTemplateRequest multiRequest = new MultiSearchTemplateRequest();
String [] searchTerms = {"elasticsearch", "logstash", "kibana"};
String [] searchTerms = {"opensearch", "dashboards"};
for (String searchTerm : searchTerms) {
SearchTemplateRequest request = new SearchTemplateRequest();

View File

@ -151,7 +151,7 @@ public class RestClient implements Closeable {
String decoded = new String(Base64.getDecoder().decode(cloudId), UTF_8);
// once decoded the parts are separated by a $ character.
// they are respectively domain name and optional port, elasticsearch id, kibana id
// they are respectively domain name and optional port, opensearch id, opensearch-dashboards id
String[] decodedParts = decoded.split("\\$");
if (decodedParts.length != 3) {
throw new IllegalStateException("cloudId " + cloudId + " did not decode to a cluster identifier correctly");

View File

@ -1,60 +1,6 @@
# Only used for testing the docker images
version: '3'
services:
elasticsearch-default-1:
image: elasticsearch:test
environment:
- node.name=elasticsearch-default-1
- cluster.initial_master_nodes=elasticsearch-default-1,elasticsearch-default-2
- discovery.seed_hosts=elasticsearch-default-2:9300
- cluster.name=elasticsearch-default
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- path.repo=/tmp/es-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
- ./docker-test-entrypoint.sh:/docker-test-entrypoint.sh
ports:
- "9200"
ulimits:
memlock:
soft: -1
hard: -1
entrypoint: /docker-test-entrypoint.sh
elasticsearch-default-2:
image: elasticsearch:test
environment:
- node.name=elasticsearch-default-2
- cluster.initial_master_nodes=elasticsearch-default-1,elasticsearch-default-2
- discovery.seed_hosts=elasticsearch-default-1:9300
- cluster.name=elasticsearch-default
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- path.repo=/tmp/es-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
- ./docker-test-entrypoint.sh:/docker-test-entrypoint.sh
ports:
- "9200"
ulimits:
memlock:
soft: -1
hard: -1
entrypoint: /docker-test-entrypoint.sh
opensearch-oss-1:
image: opensearch:test
environment:

View File

@ -1,6 +1,4 @@
#!/bin/bash
cd /usr/share/opensearch/bin/
## TODO remove this line as it's x-pack
./elasticsearch-users useradd rest_user -p test-password -r superuser || true
echo "testnode" > /tmp/password
/usr/local/bin/docker-entrypoint.sh | tee > /usr/share/opensearch/logs/console.log

View File

@ -321,8 +321,8 @@ class InstallPluginCommand extends EnvironmentAwareCommand {
return Build.CURRENT.isSnapshot();
}
/** Returns the url for an official elasticsearch plugin. */
private String getElasticUrl(
/** Returns the url for an official opensearch plugin. */
private String getOpenSearchUrl(
final Terminal terminal,
final String stagingHash,
final Version version,
@ -334,7 +334,7 @@ class InstallPluginCommand extends EnvironmentAwareCommand {
if (isSnapshot && stagingHash == null) {
throw new UserException(
ExitCodes.CONFIG,
"attempted to install release build of official plugin on snapshot build of Elasticsearch"
"attempted to install release build of official plugin on snapshot build of OpenSearch"
);
}
if (stagingHash != null) {
@ -344,6 +344,7 @@ class InstallPluginCommand extends EnvironmentAwareCommand {
baseUrl = nonReleaseUrl("staging", version, stagingHash, pluginId);
}
} else {
// TODO (URL) replace w/ opensearch artifacts URL
baseUrl = String.format(Locale.ROOT, "https://artifacts.elastic.co/downloads/elasticsearch-plugins/%s", pluginId);
}
final String platformUrl = String.format(
@ -361,6 +362,7 @@ class InstallPluginCommand extends EnvironmentAwareCommand {
}
private String nonReleaseUrl(final String hostname, final Version version, final String stagingHash, final String pluginId) {
// TODO (URL) replace w/ opensearch non-release URL
return String.format(
Locale.ROOT,
"https://%s.elastic.co/%s-%s/downloads/elasticsearch-plugins/%s",

View File

@ -149,8 +149,8 @@ public enum XContentType {
* @return a media type string without
*/
private static String removeVersionInMediaType(String mediaType) {
if (mediaType.contains("vnd.elasticsearch")) {
return mediaType.replaceAll("vnd.elasticsearch\\+", "")
if (mediaType.contains("vnd.opensearch")) {
return mediaType.replaceAll("vnd.opensearch\\+", "")
.replaceAll("\\s*;\\s*compatible-with=\\d+", "");
}
return mediaType;

View File

@ -55,7 +55,7 @@
"type":"synonym",
"synonyms":[
"kimchy => shay",
"dude => elasticsearch",
"dude => opensearch",
"abides => man!"
]
},
@ -89,13 +89,13 @@
},
"stop_within_synonym":{
"type": "stop",
"stopwords":["kimchy", "elasticsearch"]
"stopwords":["kimchy", "opensearch"]
},
"synonym_expand":{
"type":"synonym",
"synonyms":[
"kimchy , shay",
"dude , elasticsearch",
"dude , opensearch",
"abides , man!"
]
}

View File

@ -17,7 +17,7 @@
filter:
synonym:
type: synonym
synonyms: ["<p>kimchy</p> => shay", "dude => <html>elasticsearch</html>", "<font>abides</font> => man!"]
synonyms: ["<p>kimchy</p> => shay", "dude => <html>opensearch</html>", "<font>abides</font> => man!"]
- do:
indices.analyze:

View File

@ -22,7 +22,7 @@ grant {
permission java.net.SocketPermission "*", "connect";
};
grant codeBase "${codebase.elasticsearch-rest-client}" {
grant codeBase "${codebase.opensearch-rest-client}" {
// rest client uses system properties which gets the default proxy
permission java.net.NetPermission "getProxySelector";
};

View File

@ -1,6 +1,5 @@
# ca.p12
$OPENSEARCH_HOME/bin/elasticsearch-certutil ca --out ca.p12 --pass "ca-password" --days 9999
# ca.pem
@ -8,18 +7,10 @@ openssl pkcs12 -info -in ./ca.p12 -nokeys -out ca.pem -passin "pass:ca-password"
# http.p12
$OPENSEARCH_HOME/bin/elasticsearch-certutil cert --out http.zip --pass "http-password" \
--days 9999 --pem --name "http" \
--ca ca.p12 --ca-pass "ca-password" \
--dns=localhost --dns=localhost.localdomain --dns=localhost4 --dns=localhost4.localdomain4 --dns=localhost6 --dns=localhost6.localdomain6 \
--ip=127.0.0.1 --ip=0:0:0:0:0:0:0:1
unzip http.zip
rm http.zip
# client.p12
$OPENSEARCH_HOME/bin/elasticsearch-certutil cert --out client.zip --pass "client-password" \
--name "client" --days 9999 --pem \
--ca ca.p12 --ca-pass "ca-password"
unzip client.zip
rm client.zip

View File

@ -1,7 +1,7 @@
{
"status" : 200,
"name" : "Robert Kelly",
"cluster_name" : "elasticsearch",
"cluster_name" : "opensearch",
"version" : {
"number" : "1.7.5",
"build_hash" : "00f95f4ffca6de89d68b7ccaf80d148f1f70e4d4",

View File

@ -1,6 +1,6 @@
{
"name" : "Ezekiel Stane",
"cluster_name" : "elasticsearch",
"cluster_name" : "opensearch",
"version" : {
"number" : "2.3.3",
"build_hash" : "218bdf10790eef486ff2c41a3df5cfa32dadcfde",

View File

@ -49,7 +49,7 @@ import java.util.function.Function;
import static java.util.Collections.emptyList;
public class GceSeedHostsProvider implements SeedHostsProvider {
private static final Logger logger = LogManager.getLogger(GceSeedHostsProvider.class);
/**
@ -102,7 +102,7 @@ public class GceSeedHostsProvider implements SeedHostsProvider {
// We check that needed properties have been set
if (this.project == null || this.project.isEmpty() || this.zones == null || this.zones.isEmpty()) {
throw new IllegalArgumentException("one or more gce discovery settings are missing. " +
"Check elasticsearch.yml file. Should have [" + GceInstancesService.PROJECT_SETTING.getKey() +
"Check opensearch.yml file. Should have [" + GceInstancesService.PROJECT_SETTING.getKey() +
"] and [" + GceInstancesService.ZONE_SETTING.getKey() + "].");
}

View File

@ -129,7 +129,7 @@ public class GceDiscoveryTests extends OpenSearchTestCase {
Settings nodeSettings = Settings.builder()
.put(GceInstancesServiceImpl.PROJECT_SETTING.getKey(), projectName)
.put(GceInstancesServiceImpl.ZONE_SETTING.getKey(), "europe-west1-b")
.putList(GceSeedHostsProvider.TAGS_SETTING.getKey(), "elasticsearch")
.putList(GceSeedHostsProvider.TAGS_SETTING.getKey(), "opensearch")
.build();
mock = new GceInstancesServiceMock(nodeSettings);
List<TransportAddress> dynamicHosts = buildDynamicNodes(mock, nodeSettings);
@ -140,7 +140,7 @@ public class GceDiscoveryTests extends OpenSearchTestCase {
Settings nodeSettings = Settings.builder()
.put(GceInstancesServiceImpl.PROJECT_SETTING.getKey(), projectName)
.put(GceInstancesServiceImpl.ZONE_SETTING.getKey(), "europe-west1-b")
.putList(GceSeedHostsProvider.TAGS_SETTING.getKey(), "elasticsearch", "dev")
.putList(GceSeedHostsProvider.TAGS_SETTING.getKey(), "opensearch", "dev")
.build();
mock = new GceInstancesServiceMock(nodeSettings);
List<TransportAddress> dynamicHosts = buildDynamicNodes(mock, nodeSettings);
@ -161,7 +161,7 @@ public class GceDiscoveryTests extends OpenSearchTestCase {
Settings nodeSettings = Settings.builder()
.put(GceInstancesServiceImpl.PROJECT_SETTING.getKey(), projectName)
.put(GceInstancesServiceImpl.ZONE_SETTING.getKey(), "europe-west1-b")
.putList(GceSeedHostsProvider.TAGS_SETTING.getKey(), "elasticsearch")
.putList(GceSeedHostsProvider.TAGS_SETTING.getKey(), "opensearch")
.build();
mock = new GceInstancesServiceMock(nodeSettings);
List<TransportAddress> dynamicHosts = buildDynamicNodes(mock, nodeSettings);
@ -172,7 +172,7 @@ public class GceDiscoveryTests extends OpenSearchTestCase {
Settings nodeSettings = Settings.builder()
.put(GceInstancesServiceImpl.PROJECT_SETTING.getKey(), projectName)
.put(GceInstancesServiceImpl.ZONE_SETTING.getKey(), "europe-west1-b")
.putList(GceSeedHostsProvider.TAGS_SETTING.getKey(), "elasticsearch", "dev")
.putList(GceSeedHostsProvider.TAGS_SETTING.getKey(), "opensearch", "dev")
.build();
mock = new GceInstancesServiceMock(nodeSettings);
List<TransportAddress> dynamicHosts = buildDynamicNodes(mock, nodeSettings);

View File

@ -109,6 +109,7 @@ public class RetryHttpInitializerWrapperTests extends OpenSearchTestCase {
.setApplicationName("test")
.build();
// TODO (URL) replace w/ opensearch url
HttpRequest request = client.getRequestFactory().buildRequest("Get", new GenericUrl("http://elasticsearch.com"), null);
HttpResponse response = request.execute();
@ -141,6 +142,7 @@ public class RetryHttpInitializerWrapperTests extends OpenSearchTestCase {
.setApplicationName("test")
.build();
// TODO (URL) replace w/ opensearch URL
HttpRequest request1 = client.getRequestFactory().buildRequest("Get", new GenericUrl("http://elasticsearch.com"), null);
try {
request1.execute();
@ -167,6 +169,7 @@ public class RetryHttpInitializerWrapperTests extends OpenSearchTestCase {
.setApplicationName("test")
.build();
// TODO (URL) replace w/ opensearch URL
HttpRequest request = client.getRequestFactory().buildRequest("Get", new GenericUrl("http://elasticsearch.com"), null);
HttpResponse response = request.execute();

View File

@ -5,7 +5,7 @@
<title>Hello</title>
<meta name="date" content="">
<meta name="Author" content="kimchy">
<meta name="Keywords" content="elasticsearch,cool,bonsai">
<meta name="Keywords" content="opensearch,cool,bonsai">
</head>
<body>Hello again. This is a test sentence to check for language detection.</body>
</html>

View File

@ -5,7 +5,7 @@
<title>Hello</title>
<meta name="date" content="2012-11-30">
<meta name="Author" content="kimchy">
<meta name="Keywords" content="elasticsearch,cool,bonsai">
<meta name="Keywords" content="opensearch,cool,bonsai">
</head>
<body>World</body>
</html>

View File

@ -4,7 +4,7 @@
<head>
<title>Hello</title>
<meta name="Author" content="kimchy">
<meta name="Keywords" content="elasticsearch,cool,bonsai">
<meta name="Keywords" content="opensearch,cool,bonsai">
</head>
<body>World</body>
</html>

View File

@ -28,7 +28,7 @@
index: test
id: 1
- length: { _source.attachment: 6 }
- match: { _source.attachment.content: "Test elasticsearch" }
- match: { _source.attachment.content: "Test opensearch" }
- match: { _source.attachment.language: "et" }
- match: { _source.attachment.author: "David Pilato" }
- match: { _source.attachment.date: "2016-03-10T08:25:00Z" }
@ -66,7 +66,7 @@
index: test
id: 1
- length: { _source.attachment: 6 }
- match: { _source.attachment.content: "Test elasticsearch" }
- match: { _source.attachment.content: "Test opensearch" }
- match: { _source.attachment.language: "et" }
- match: { _source.attachment.author: "David Pilato" }
- match: { _source.attachment.date: "2016-03-10T08:24:00Z" }

View File

@ -64,7 +64,7 @@ public class AzureRepository extends MeteredBlobStoreRepository {
Property.NodeScope, Property.Deprecated);
public static final Setting<String> CLIENT_NAME = new Setting<>("client", ACCOUNT_SETTING, Function.identity());
public static final Setting<String> CONTAINER_SETTING =
new Setting<>("container", "elasticsearch-snapshots", Function.identity(), Property.NodeScope);
new Setting<>("container", "opensearch-snapshots", Function.identity(), Property.NodeScope);
public static final Setting<String> BASE_PATH_SETTING = Setting.simpleString("base_path", Property.NodeScope);
public static final Setting<LocationMode> LOCATION_MODE_SETTING = new Setting<>("location_mode",
s -> LocationMode.PRIMARY_ONLY.toString(), s -> LocationMode.valueOf(s.toUpperCase(Locale.ROOT)), Property.NodeScope);

View File

@ -257,7 +257,7 @@ class S3Repository extends MeteredBlobStoreRepository {
// provided repository settings
deprecationLogger.deprecate("s3_repository_secret_settings",
"Using s3 access/secret key from repository settings. Instead "
+ "store these in named clients and the elasticsearch keystore for secure settings.");
+ "store these in named clients and the opensearch keystore for secure settings.");
}
coolDown = COOLDOWN_PERIOD.get(metadata.settings());

View File

@ -23,14 +23,14 @@ See the section in [TESTING.asciidoc](../../TESTING.asciidoc#testing-packaging)
When gradle runs the packaging tests on a VM, it runs the full suite by
default. To add a test class to the suite, add its `class` to the
`@SuiteClasses` annotation in [PackagingTests.java](src/main/java/org/elasticsearch/packaging/PackagingTests.java).
`@SuiteClasses` annotation in [PackagingTests.java](src/main/java/org/opensearch/packaging/PackagingTests.java).
If a test class is added to the project but not to this annotation, it will not
run in CI jobs. The test classes are run in the order they are listed in the
annotation.
## Choosing which distributions to test
Distributions are represented by [enum values](src/main/java/org/elasticsearch/packaging/util/Distribution.java)
Distributions are represented by [enum values](src/main/java/org/opensearch/packaging/util/Distribution.java)
which know if they are compatible with the platform the tests are currently
running on. To skip a test if the distribution it's using isn't compatible with
the current platform, put this [assumption](https://github.com/junit-team/junit4/wiki/assumptions-with-assume)
@ -41,7 +41,7 @@ assumeTrue(distribution.packaging.compatible);
```
Similarly if you write a test that is intended only for particular platforms,
you can make an assumption using the constants and methods in [Platforms.java](src/main/java/org/elasticsearch/packaging/util/Platforms.java)
you can make an assumption using the constants and methods in [Platforms.java](src/main/java/org/opensearch/packaging/util/Platforms.java)
```java
assumeTrue("only run on windows", Platforms.WINDOWS);
@ -73,14 +73,14 @@ public class MyTestDefaultTar extends MyTestCase {
```
That way when a test fails the user gets told explicitly that `MyTestDefaultTar`
failed, and to reproduce it they should run that class. See [ArchiveTestCase](src/main/java/org/elasticsearch/packaging/test/ArchiveTestCase.java)
failed, and to reproduce it they should run that class. See [ArchiveTestCase](src/main/java/org/opensearch/packaging/test/ArchiveTestCase.java)
and its children for an example of this.
## Running external commands
In general it's probably best to avoid running external commands when a good
Java alternative exists. For example most filesystem operations can be done with
the java.nio.file APIs. For those that aren't, use an instance of [Shell](src/main/java/org/elasticsearch/packaging/util/Shell.java)
the java.nio.file APIs. For those that aren't, use an instance of [Shell](src/main/java/org/opensearch/packaging/util/Shell.java)
This class runs scripts in either bash with the `bash -c <script>` syntax,
or in powershell with the `powershell.exe -Command <script>` syntax.

View File

@ -79,7 +79,7 @@ public class ArchiveTests extends PackagingTestCase {
if (distribution().hasJdk) {
mv(installation.bundledJdk, relocatedJdk);
}
// ask for elasticsearch version to quickly exit if java is actually found (ie test failure)
// ask for opensearch version to quickly exit if java is actually found (ie test failure)
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"));
@ -94,7 +94,7 @@ public class ArchiveTests extends PackagingTestCase {
final Installation.Executables bin = installation.executables();
sh.getEnv().put("JAVA_HOME", "doesnotexist");
// ask for elasticsearch version to quickly exit if java is actually found (ie test failure)
// ask for opensearch version to quickly exit if java is actually found (ie test failure)
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"));
@ -110,7 +110,7 @@ public class ArchiveTests extends PackagingTestCase {
try {
mv(installation.bundledJdk, relocatedJdk);
// ask for elasticsearch version to avoid starting the app
// ask for opensearch version to avoid starting the app
final Result runResult = sh.run(bin.opensearch.toString() + " -V");
assertThat(runResult.stdout, startsWith("Version: "));
} finally {

View File

@ -410,8 +410,8 @@ public class KeystoreManagementTests extends PackagingTestCase {
// We need a local shell to put the correct permissions on our mounted directory.
Shell localShell = new Shell();
localShell.run("docker exec --tty " + Docker.getContainerId() + " chown elasticsearch:root " + dockerTemp);
localShell.run("docker exec --tty " + Docker.getContainerId() + " chown elasticsearch:root " + dockerTemp.resolve("set-pass.sh"));
localShell.run("docker exec --tty " + Docker.getContainerId() + " chown opensearch:root " + dockerTemp);
localShell.run("docker exec --tty " + Docker.getContainerId() + " chown opensearch:root " + dockerTemp.resolve("set-pass.sh"));
sh.run("bash " + dockerTemp.resolve("set-pass.sh"));
@ -488,7 +488,7 @@ public class KeystoreManagementTests extends PackagingTestCase {
break;
case DEB:
case RPM:
assertThat(keystore, file(File, "root", "elasticsearch", p660));
assertThat(keystore, file(File, "root", "opensearch", p660));
break;
case DOCKER:
assertPermissionsAndOwnership(keystore, p660);

View File

@ -102,7 +102,7 @@ public class PackageTests extends PackagingTestCase {
Files.write(installation.envFile, originalEnvFile);
}
assertThat(FileUtils.slurpAllLogs(installation.logs, "opensearch.log", "elasticsearch*.log.gz"), containsString(systemJavaHome));
assertThat(FileUtils.slurpAllLogs(installation.logs, "opensearch.log", "opensearch*.log.gz"), containsString(systemJavaHome));
}
public void test32JavaHomeOverride() throws Exception {

View File

@ -37,29 +37,29 @@ public class Cleanup {
private static final List<String> ELASTICSEARCH_FILES_LINUX = Arrays.asList(
"/usr/share/opensearch",
"/etc/elasticsearch/opensearch.keystore",
"/etc/elasticsearch",
"/var/lib/elasticsearch",
"/var/log/elasticsearch",
"/etc/default/elasticsearch",
"/etc/sysconfig/elasticsearch",
"/var/run/elasticsearch",
"/usr/share/doc/elasticsearch",
"/usr/lib/systemd/system/elasticsearch.conf",
"/usr/lib/tmpfiles.d/elasticsearch.conf",
"/usr/lib/sysctl.d/elasticsearch.conf"
"/etc/opensearch/opensearch.keystore",
"/etc/opensearch",
"/var/lib/opensearch",
"/var/log/opensearch",
"/etc/default/opensearch",
"/etc/sysconfig/opensearch",
"/var/run/opensearch",
"/usr/share/doc/opensearch",
"/usr/lib/systemd/system/opensearch.conf",
"/usr/lib/tmpfiles.d/opensearch.conf",
"/usr/lib/sysctl.d/opensearch.conf"
);
// todo
private static final List<String> ELASTICSEARCH_FILES_WINDOWS = Collections.emptyList();
private static final List<String> OPENSEARCH_FILES_WINDOWS = Collections.emptyList();
public static void cleanEverything() throws Exception {
final Shell sh = new Shell();
// kill elasticsearch processes
// kill opensearch processes
Platforms.onLinux(() -> {
sh.runIgnoreExitCode("pkill -u elasticsearch");
sh.runIgnoreExitCode("ps aux | grep -i 'org.opensearch.bootstrap.Elasticsearch' | awk {'print $2'} | xargs kill -9");
sh.runIgnoreExitCode("pkill -u opensearch");
sh.runIgnoreExitCode("ps aux | grep -i 'org.opensearch.bootstrap.OpenSearch' | awk {'print $2'} | xargs kill -9");
});
Platforms.onWindows(
@ -67,7 +67,7 @@ public class Cleanup {
// the view of processes returned by Get-Process doesn't expose command line arguments, so we use WMI here
sh.runIgnoreExitCode(
"Get-WmiObject Win32_Process | "
+ "Where-Object { $_.CommandLine -Match 'org.opensearch.bootstrap.Elasticsearch' } | "
+ "Where-Object { $_.CommandLine -Match 'org.opensearch.bootstrap.OpenSearch' } | "
+ "ForEach-Object { $_.Terminate() }"
);
}
@ -75,21 +75,21 @@ public class Cleanup {
Platforms.onLinux(Cleanup::purgePackagesLinux);
// remove elasticsearch users
// remove opensearch users
Platforms.onLinux(() -> {
sh.runIgnoreExitCode("userdel elasticsearch");
sh.runIgnoreExitCode("groupdel elasticsearch");
sh.runIgnoreExitCode("userdel opensearch");
sh.runIgnoreExitCode("groupdel opensearch");
});
// when we run es as a role user on windows, add the equivalent here
// delete files that may still exist
lsGlob(getRootTempDir(), "elasticsearch*").forEach(FileUtils::rm);
final List<String> filesToDelete = Platforms.WINDOWS ? ELASTICSEARCH_FILES_WINDOWS : ELASTICSEARCH_FILES_LINUX;
lsGlob(getRootTempDir(), "opensearch*").forEach(FileUtils::rm);
final List<String> filesToDelete = Platforms.WINDOWS ? OPENSEARCH_FILES_WINDOWS : ELASTICSEARCH_FILES_LINUX;
// windows needs leniency due to asinine releasing of file locking async from a process exiting
Consumer<? super Path> rm = Platforms.WINDOWS ? FileUtils::rmWithRetries : FileUtils::rm;
filesToDelete.stream().map(Paths::get).filter(Files::exists).forEach(rm);
// disable elasticsearch service
// disable opensearch service
// todo add this for windows when adding tests for service intallation
if (Platforms.LINUX && isSystemd()) {
sh.run("systemctl unmask systemd-sysctl.service");
@ -101,13 +101,13 @@ public class Cleanup {
if (isRPM()) {
// 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");
// this may leave behind config files in /etc/opensearch, but a later step in this cleanup will get them
sh.runIgnoreExitCode("rpm --quiet -e opensearch");
sh.runIgnoreExitCode("rpm --quiet -e opensearch-oss");
}
if (isDPKG()) {
sh.runIgnoreExitCode("dpkg --purge elasticsearch opensearch-oss");
sh.runIgnoreExitCode("dpkg --purge opensearch opensearch-oss");
}
}
}

View File

@ -186,7 +186,7 @@ public class Docker {
assertThat(localPath, fileExists());
if (Platforms.WINDOWS == false && System.getProperty("user.name").equals("root") && uid == null) {
// The tests are running as root, but the process in the Docker container runs as `elasticsearch` (UID 1000),
// The tests are running as root, but the process in the Docker container runs as `opensearch` (UID 1000),
// so we need to ensure that the container process is able to read the bind-mounted files.
//
// NOTE that we don't do this if a UID is specified - in that case, we assume that the caller knows
@ -332,7 +332,7 @@ public class Docker {
protected String[] getScriptCommand(String script) {
assert containerId != null;
return super.getScriptCommand("docker exec --user elasticsearch:root --tty " + containerId + " " + script);
return super.getScriptCommand("docker exec --user opensearch:root --tty " + containerId + " " + script);
}
}
@ -458,7 +458,7 @@ public class Docker {
Set<PosixFilePermission> actualPermissions = fromString(permissions.substring(1, 10));
assertEquals("Permissions of " + path + " are wrong", actualPermissions, expectedPermissions);
assertThat("File owner of " + path + " is wrong", username, equalTo("elasticsearch"));
assertThat("File owner of " + path + " is wrong", username, equalTo("opensearch"));
assertThat("File group of " + path + " is wrong", group, equalTo("root"));
}
@ -487,10 +487,10 @@ public class Docker {
}
private static void verifyOssInstallation(Installation es) {
dockerShell.run("id elasticsearch");
dockerShell.run("getent group elasticsearch");
dockerShell.run("id opensearch");
dockerShell.run("getent group opensearch");
final Shell.Result passwdResult = dockerShell.run("getent passwd elasticsearch");
final Shell.Result passwdResult = dockerShell.run("getent passwd opensearch");
final String homeDir = passwdResult.stdout.trim().split(":")[5];
assertThat(homeDir, equalTo("/usr/share/opensearch"));

View File

@ -304,7 +304,7 @@ public class FileUtils {
}
public static Path getDefaultArchiveInstallPath() {
return getRootTempDir().resolve("elasticsearch");
return getRootTempDir().resolve("opensearch");
}
private static final Pattern VERSION_REGEX = Pattern.compile("(\\d+\\.\\d+\\.\\d+(-SNAPSHOT)?)");

View File

@ -55,7 +55,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 SYSVINIT_SCRIPT = Paths.get("/etc/init.d/opensearch");
public static final Path SYSTEMD_SERVICE = Paths.get("/usr/lib/systemd/system/opensearch.service");
public static void assertInstalled(Distribution distribution) throws Exception {
@ -163,44 +163,46 @@ public class Packages {
verifyOssInstallation(installation, distribution, sh);
}
private static void verifyOssInstallation(Installation es, Distribution distribution, Shell sh) {
private static void verifyOssInstallation(Installation opensearch, Distribution distribution, Shell sh) {
sh.run("id elasticsearch");
sh.run("getent group elasticsearch");
sh.run("id opensearch");
sh.run("getent group opensearch");
final Result passwdResult = sh.run("getent passwd elasticsearch");
final Result passwdResult = sh.run("getent passwd opensearch");
final Path homeDir = Paths.get(passwdResult.stdout.trim().split(":")[5]);
assertThat("elasticsearch user home directory must not exist", homeDir, fileDoesNotExist());
assertThat("opensearch user home directory must not exist", homeDir, fileDoesNotExist());
Stream.of(es.home, es.plugins, es.modules).forEach(dir -> assertThat(dir, file(Directory, "root", "root", p755)));
Stream.of(opensearch.home, opensearch.plugins, opensearch.modules)
.forEach(dir -> assertThat(dir, file(Directory, "root", "root", p755)));
Stream.of(es.data, es.logs).forEach(dir -> assertThat(dir, file(Directory, "elasticsearch", "elasticsearch", p750)));
Stream.of(opensearch.data, opensearch.logs).forEach(dir -> assertThat(dir, file(Directory, "opensearch", "opensearch", p750)));
// we shell out here because java's posix file permission view doesn't support special modes
assertThat(es.config, file(Directory, "root", "elasticsearch", p750));
assertThat(sh.run("find \"" + es.config + "\" -maxdepth 0 -printf \"%m\"").stdout, containsString("2750"));
assertThat(opensearch.config, file(Directory, "root", "opensearch", p750));
assertThat(sh.run("find \"" + opensearch.config + "\" -maxdepth 0 -printf \"%m\"").stdout, containsString("2750"));
final Path jvmOptionsDirectory = es.config.resolve("jvm.options.d");
assertThat(jvmOptionsDirectory, file(Directory, "root", "elasticsearch", p750));
final Path jvmOptionsDirectory = opensearch.config.resolve("jvm.options.d");
assertThat(jvmOptionsDirectory, file(Directory, "root", "opensearch", p750));
assertThat(sh.run("find \"" + jvmOptionsDirectory + "\" -maxdepth 0 -printf \"%m\"").stdout, containsString("2750"));
Stream.of("opensearch.keystore", "opensearch.yml", "jvm.options", "log4j2.properties")
.forEach(configFile -> assertThat(es.config(configFile), file(File, "root", "elasticsearch", p660)));
assertThat(es.config(".opensearch.keystore.initial_md5sum"), file(File, "root", "elasticsearch", p644));
.forEach(configFile -> assertThat(opensearch.config(configFile), file(File, "root", "opensearch", p660)));
assertThat(opensearch.config(".opensearch.keystore.initial_md5sum"), file(File, "root", "opensearch", p644));
assertThat(sh.run("sudo -u elasticsearch " + es.bin("opensearch-keystore") + " list").stdout, containsString("keystore.seed"));
assertThat(sh.run("sudo -u opensearch " + opensearch.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(opensearch.bin, opensearch.lib).forEach(dir -> assertThat(dir, file(Directory, "root", "root", p755)));
Stream.of("elasticsearch", "opensearch-plugin", "opensearch-keystore", "opensearch-shard", "opensearch-shard")
.forEach(executable -> assertThat(es.bin(executable), file(File, "root", "root", p755)));
Stream.of("opensearch", "opensearch-plugin", "opensearch-keystore", "opensearch-shard", "opensearch-shard")
.forEach(executable -> assertThat(opensearch.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)));
Stream.of("NOTICE.txt", "README.asciidoc")
.forEach(doc -> assertThat(opensearch.home.resolve(doc), file(File, "root", "root", p644)));
assertThat(es.envFile, file(File, "root", "elasticsearch", p660));
assertThat(opensearch.envFile, file(File, "root", "opensearch", p660));
if (distribution.packaging == Distribution.Packaging.RPM) {
assertThat(es.home.resolve("LICENSE.txt"), file(File, "root", "root", p644));
assertThat(opensearch.home.resolve("LICENSE.txt"), file(File, "root", "root", p644));
} else {
Path copyrightDir = Paths.get(sh.run("readlink -f /usr/share/doc/").stdout.trim());
assertThat(copyrightDir, file(Directory, "root", "root", p755));
@ -208,11 +210,8 @@ public class Packages {
}
if (isSystemd()) {
Stream.of(
SYSTEMD_SERVICE,
Paths.get("/usr/lib/tmpfiles.d/elasticsearch.conf"),
Paths.get("/usr/lib/sysctl.d/elasticsearch.conf")
).forEach(confFile -> assertThat(confFile, file(File, "root", "root", p644)));
Stream.of(SYSTEMD_SERVICE, Paths.get("/usr/lib/tmpfiles.d/opensearch.conf"), Paths.get("/usr/lib/sysctl.d/opensearch.conf"))
.forEach(confFile -> assertThat(confFile, file(File, "root", "root", p644)));
final String sysctlExecutable = (distribution.packaging == Distribution.Packaging.RPM) ? "/usr/sbin/sysctl" : "/sbin/sysctl";
assertThat(sh.run(sysctlExecutable + " vm.max_map_count").stdout, containsString("vm.max_map_count = 262144"));

View File

@ -92,7 +92,7 @@ public class Shell {
}
public void chown(Path path) throws Exception {
Platforms.onLinux(() -> run("chown -R elasticsearch:elasticsearch " + path));
Platforms.onLinux(() -> run("chown -R opensearch:opensearch " + path));
Platforms.onWindows(
() -> run(
String.format(

View File

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

View File

@ -16,7 +16,7 @@ services:
timeout: 1s
retries: 5
elasticsearch:
opensearch:
image: opensearch-oss:test
environment:
discovery.type: single-node

View File

@ -16,7 +16,7 @@ services:
timeout: 1s
retries: 5
elasticsearch:
opensearch:
image: opensearch:test
environment:
discovery.type: single-node

View File

@ -10,7 +10,7 @@ Elasticsearch as follows:
[source,sh]
---------------------
bin/elasticsearch -Enode.attr.testattr=test -Epath.repo=/tmp -Erepositories.url.allowed_urls='http://snapshot.*'
bin/opensearch -Enode.attr.testattr=test -Epath.repo=/tmp -Erepositories.url.allowed_urls='http://snapshot.*'
---------------------
=======================================

View File

@ -184,7 +184,7 @@ public class UpdateIT extends OpenSearchIntegTestCase {
// Script logic is
// 1) New accounts take balance from "balance" in upsert doc and first payment is charged at 50%
// 2) Existing accounts subtract full payment from balance stored in elasticsearch
// 2) Existing accounts subtract full payment from balance stored in opensearch
int openingBalance=10;

View File

@ -56,7 +56,7 @@ public abstract class RestResizeHandler extends BaseRestHandler {
public final RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
final ResizeRequest resizeRequest = new ResizeRequest(request.param("target"), request.param("index"));
resizeRequest.setResizeType(getResizeType());
// copy_settings should be removed in Elasticsearch 8.0.0; cf. https://github.com/elastic/elasticsearch/issues/28347
// copy_settings should be removed in OpenSearch 1.0.0; cf. https://github.com/elastic/elasticsearch/issues/28347
assert Version.CURRENT.major < 8;
final String rawCopySettings = request.param("copy_settings");
final Boolean copySettings;

View File

@ -87,18 +87,18 @@ public class XContentTypeTests extends OpenSearchTestCase {
}
public void testVersionedMediaType() throws Exception {
assertThat(XContentType.fromMediaTypeOrFormat("application/vnd.elasticsearch+json;compatible-with=7"),
assertThat(XContentType.fromMediaTypeOrFormat("application/vnd.opensearch+json;compatible-with=7"),
equalTo(XContentType.JSON));
assertThat(XContentType.fromMediaTypeOrFormat("application/vnd.elasticsearch+yaml;compatible-with=7"),
assertThat(XContentType.fromMediaTypeOrFormat("application/vnd.opensearch+yaml;compatible-with=7"),
equalTo(XContentType.YAML));
assertThat(XContentType.fromMediaTypeOrFormat("application/vnd.elasticsearch+cbor;compatible-with=7"),
assertThat(XContentType.fromMediaTypeOrFormat("application/vnd.opensearch+cbor;compatible-with=7"),
equalTo(XContentType.CBOR));
assertThat(XContentType.fromMediaTypeOrFormat("application/vnd.elasticsearch+smile;compatible-with=7"),
assertThat(XContentType.fromMediaTypeOrFormat("application/vnd.opensearch+smile;compatible-with=7"),
equalTo(XContentType.SMILE));
assertThat(XContentType.fromMediaTypeOrFormat("application/vnd.elasticsearch+json ;compatible-with=7"),
assertThat(XContentType.fromMediaTypeOrFormat("application/vnd.opensearch+json ;compatible-with=7"),
equalTo(XContentType.JSON));
assertThat(XContentType.fromMediaTypeOrFormat("application/vnd.elasticsearch+json ;compatible-with=7;charset=utf-8"),
assertThat(XContentType.fromMediaTypeOrFormat("application/vnd.opensearch+json ;compatible-with=7;charset=utf-8"),
equalTo(XContentType.JSON));
}
}

View File

@ -51,7 +51,7 @@ public abstract class AbstractFilteringTestCase extends OpenSearchTestCase {
.field("timestamp", 1428582942867L)
.nullField("default")
.startArray("tags")
.value("elasticsearch")
.value("opensearch")
.value("java")
.endArray()
.startArray("authors")
@ -146,7 +146,7 @@ public abstract class AbstractFilteringTestCase extends OpenSearchTestCase {
.field("timestamp", 1428582942867L)
.nullField("default")
.startArray("tags")
.value("elasticsearch")
.value("opensearch")
.value("java")
.endArray()
.startArray("authors")
@ -277,7 +277,7 @@ public abstract class AbstractFilteringTestCase extends OpenSearchTestCase {
.field("timestamp", 1428582942867L)
.nullField("default")
.startArray("tags")
.value("elasticsearch")
.value("opensearch")
.value("java")
.endArray()
.startArray("authors")
@ -312,7 +312,7 @@ public abstract class AbstractFilteringTestCase extends OpenSearchTestCase {
.field("timestamp", 1428582942867L)
.nullField("default")
.startArray("tags")
.value("elasticsearch")
.value("opensearch")
.value("java")
.endArray()
.startArray("authors")
@ -383,7 +383,7 @@ public abstract class AbstractFilteringTestCase extends OpenSearchTestCase {
public void testSimpleArrayInclusive() throws Exception {
final Builder expected = builder -> builder.startObject()
.startArray("tags")
.value("elasticsearch")
.value("opensearch")
.value("java")
.endArray()
.endObject();
@ -491,7 +491,7 @@ public abstract class AbstractFilteringTestCase extends OpenSearchTestCase {
.field("timestamp", 1428582942867L)
.nullField("default")
.startArray("tags")
.value("elasticsearch")
.value("opensearch")
.value("java")
.endArray()
.startObject("properties")
@ -574,7 +574,7 @@ public abstract class AbstractFilteringTestCase extends OpenSearchTestCase {
.field("timestamp", 1428582942867L)
.nullField("default")
.startArray("tags")
.value("elasticsearch")
.value("opensearch")
.value("java")
.endArray()
.startArray("authors")
@ -701,7 +701,7 @@ public abstract class AbstractFilteringTestCase extends OpenSearchTestCase {
.field("timestamp", 1428582942867L)
.nullField("default")
.startArray("tags")
.value("elasticsearch")
.value("opensearch")
.value("java")
.endArray()
.startArray("authors")
@ -808,7 +808,7 @@ public abstract class AbstractFilteringTestCase extends OpenSearchTestCase {
.field("timestamp", 1428582942867L)
.nullField("default")
.startArray("tags")
.value("elasticsearch")
.value("opensearch")
.value("java")
.endArray()
.startArray("authors")
@ -902,7 +902,7 @@ public abstract class AbstractFilteringTestCase extends OpenSearchTestCase {
.field("timestamp", 1428582942867L)
.nullField("default")
.startArray("tags")
.value("elasticsearch")
.value("opensearch")
.value("java")
.endArray()
.startArray("authors")
@ -1003,7 +1003,7 @@ public abstract class AbstractFilteringTestCase extends OpenSearchTestCase {
.field("timestamp", 1428582942867L)
.nullField("default")
.startArray("tags")
.value("elasticsearch")
.value("opensearch")
.value("java")
.endArray()
.startArray("authors")
@ -1200,7 +1200,7 @@ public abstract class AbstractFilteringTestCase extends OpenSearchTestCase {
final Builder expected = builder -> builder
.startObject()
.startArray("tags")
.value("elasticsearch")
.value("opensearch")
.value("java")
.endArray()
.startArray("authors")

View File

@ -260,7 +260,7 @@ public class BoolQueryBuilderTests extends AbstractQueryTestCase<BoolQueryBuilde
" }, {" +
" \"term\" : {" +
" \"tag\" : {" +
" \"value\" : \"elasticsearch\"," +
" \"value\" : \"opensearch\"," +
" \"boost\" : 1.0" +
" }" +
" }" +

View File

@ -261,7 +261,7 @@ public class TermsQueryBuilderTests extends AbstractQueryTestCase<TermsQueryBuil
String json =
"{\n" +
" \"terms\" : {\n" +
" \"user\" : [ \"kimchy\", \"elasticsearch\" ],\n" +
" \"user\" : [ \"kimchy\", \"opensearch\" ],\n" +
" \"boost\" : 1.0\n" +
" }\n" +
"}";

View File

@ -46,7 +46,7 @@ public class PluginInfoTests extends OpenSearchTestCase {
"description", "fake desc",
"name", "my_plugin",
"version", "1.0",
"elasticsearch.version", Version.CURRENT.toString(),
"opensearch.version", Version.CURRENT.toString(),
"java.version", System.getProperty("java.specification.version"),
"classname", "FakePlugin");
PluginInfo info = PluginInfo.readFromProperties(pluginDir);
@ -90,7 +90,7 @@ public class PluginInfoTests extends OpenSearchTestCase {
"name", "my_plugin",
"version", "1.0");
IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> PluginInfo.readFromProperties(pluginDir));
assertThat(e.getMessage(), containsString("[elasticsearch.version] is missing"));
assertThat(e.getMessage(), containsString("[opensearch.version] is missing"));
}
public void testReadFromPropertiesJavaVersionMissing() throws Exception {
@ -98,7 +98,7 @@ public class PluginInfoTests extends OpenSearchTestCase {
PluginTestUtil.writePluginProperties(pluginDir,
"description", "fake desc",
"name", "my_plugin",
"elasticsearch.version", Version.CURRENT.toString(),
"opensearch.version", Version.CURRENT.toString(),
"version", "1.0");
IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> PluginInfo.readFromProperties(pluginDir));
assertThat(e.getMessage(), containsString("[java.version] is missing"));
@ -110,7 +110,7 @@ public class PluginInfoTests extends OpenSearchTestCase {
PluginTestUtil.writePluginProperties(pluginDir,
"description", "fake desc",
"name", pluginName,
"elasticsearch.version", Version.CURRENT.toString(),
"opensearch.version", Version.CURRENT.toString(),
"java.version", "1.7.0_80",
"classname", "FakePlugin",
"version", "1.0");
@ -125,7 +125,7 @@ public class PluginInfoTests extends OpenSearchTestCase {
"description", "fake desc",
"version", "1.0",
"name", "my_plugin",
"elasticsearch.version", "bogus");
"opensearch.version", "bogus");
IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> PluginInfo.readFromProperties(pluginDir));
assertThat(e.getMessage(), containsString("version needs to contain major, minor, and revision"));
}
@ -136,7 +136,7 @@ public class PluginInfoTests extends OpenSearchTestCase {
"description", "fake desc",
"name", "my_plugin",
"version", "1.0",
"elasticsearch.version", Version.CURRENT.toString(),
"opensearch.version", Version.CURRENT.toString(),
"java.version", System.getProperty("java.specification.version"));
IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> PluginInfo.readFromProperties(pluginDir));
assertThat(e.getMessage(), containsString("property [classname] is missing"));
@ -148,7 +148,7 @@ public class PluginInfoTests extends OpenSearchTestCase {
"description", "fake desc",
"name", "my_plugin",
"version", "1.0",
"elasticsearch.version", Version.CURRENT.toString(),
"opensearch.version", Version.CURRENT.toString(),
"java.version", System.getProperty("java.specification.version"),
"classname", "FakePlugin",
"extended.plugins", "foo");
@ -162,7 +162,7 @@ public class PluginInfoTests extends OpenSearchTestCase {
"description", "fake desc",
"name", "my_plugin",
"version", "1.0",
"elasticsearch.version", Version.CURRENT.toString(),
"opensearch.version", Version.CURRENT.toString(),
"java.version", System.getProperty("java.specification.version"),
"classname", "FakePlugin",
"extended.plugins", "foo,bar,baz");
@ -176,7 +176,7 @@ public class PluginInfoTests extends OpenSearchTestCase {
"description", "fake desc",
"name", "my_plugin",
"version", "1.0",
"elasticsearch.version", Version.CURRENT.toString(),
"opensearch.version", Version.CURRENT.toString(),
"java.version", System.getProperty("java.specification.version"),
"classname", "FakePlugin",
"extended.plugins", "");
@ -224,7 +224,7 @@ public class PluginInfoTests extends OpenSearchTestCase {
"classname", "Foo",
"name", "my_plugin",
"version", "1.0",
"elasticsearch.version", Version.CURRENT.toString(),
"opensearch.version", Version.CURRENT.toString(),
"java.version", System.getProperty("java.specification.version"));
IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> PluginInfo.readFromProperties(pluginDir));
assertThat(e.getMessage(), containsString("Unknown properties in plugin descriptor"));

View File

@ -207,14 +207,14 @@ public class PluginsServiceTests extends OpenSearchTestCase {
"description", "fake",
"name", "fake",
"version", "1.0.0",
"elasticsearch.version", Version.CURRENT.toString(),
"opensearch.version", Version.CURRENT.toString(),
"java.version", System.getProperty("java.specification.version"),
"classname", "Fake",
"has.native.controller", "false");
final IllegalStateException e = expectThrows(IllegalStateException.class, () -> newPluginsService(settings));
final String expected = String.format(
Locale.ROOT,
"found file [%s] from a failed attempt to remove the plugin [fake]; execute [elasticsearch-plugin remove fake]",
"found file [%s] from a failed attempt to remove the plugin [fake]; execute [opensearch-plugin remove fake]",
removing);
assertThat(e, hasToString(containsString(expected)));
}
@ -592,7 +592,7 @@ public class PluginsServiceTests extends OpenSearchTestCase {
"description", "whatever",
"name", "myplugin",
"version", "1.0.0",
"elasticsearch.version", Version.CURRENT.toString(),
"opensearch.version", Version.CURRENT.toString(),
"java.version", System.getProperty("java.specification.version"),
"extended.plugins", "nonextensible",
"classname", "test.DummyPlugin");
@ -605,7 +605,7 @@ public class PluginsServiceTests extends OpenSearchTestCase {
"description", "whatever",
"name", "nonextensible",
"version", "1.0.0",
"elasticsearch.version", Version.CURRENT.toString(),
"opensearch.version", Version.CURRENT.toString(),
"java.version", System.getProperty("java.specification.version"),
"classname", "test.NonExtensiblePlugin");
try (InputStream jar = PluginsServiceTests.class.getResourceAsStream("non-extensible-plugin.jar")) {
@ -639,7 +639,7 @@ public class PluginsServiceTests extends OpenSearchTestCase {
"description", "description",
"name", "fake",
"version", "1.0.0",
"elasticsearch.version", Version.CURRENT.toString(),
"opensearch.version", Version.CURRENT.toString(),
"java.version", System.getProperty("java.specification.version"),
"classname", "test.DummyPlugin");
@ -682,7 +682,7 @@ public class PluginsServiceTests extends OpenSearchTestCase {
"description", "description",
"name", "fake",
"version", "1.0.0",
"elasticsearch.version", Version.CURRENT.toString(),
"opensearch.version", Version.CURRENT.toString(),
"java.version", System.getProperty("java.specification.version"),
"classname", "test.DummyPlugin");
try (InputStream jar = PluginsServiceTests.class.getResourceAsStream("dummy-plugin.jar")) {
@ -707,7 +707,7 @@ public class PluginsServiceTests extends OpenSearchTestCase {
"description", "description",
"name", "fake",
"version", "1.0.0",
"elasticsearch.version", Version.CURRENT.toString(),
"opensearch.version", Version.CURRENT.toString(),
"java.version", System.getProperty("java.specification.version"),
"classname", TestPlugin.class.getName()); // set a class defined outside the bundle (in parent class-loader of plugin)

View File

@ -44,7 +44,7 @@ import static org.hamcrest.Matchers.not;
* <code>node.name</code>, <code>cluster.name</code>, <code>node.id</code>, <code>cluster.uuid</code>
* should not change across all log lines
*
* Note that this won't pass for nodes in clusters that don't have the node name defined in elasticsearch.yml <strong>and</strong> start
* Note that this won't pass for nodes in clusters that don't have the node name defined in opensearch.yml <strong>and</strong> start
* with DEBUG or TRACE level logging. Those nodes log a few lines before the node.name is set by <code>LogConfigurator.setNodeName</code>.
*/
public abstract class JsonLogsIntegTestCase extends OpenSearchRestTestCase {

View File

@ -62,7 +62,7 @@ public class TestThreadInfoPatternConverter extends LogEventPatternConverter {
}
private static final Pattern ELASTICSEARCH_THREAD_NAME_PATTERN =
Pattern.compile("elasticsearch\\[(.+)\\]\\[.+\\].+");
Pattern.compile("opensearch\\[(.+)\\]\\[.+\\].+");
private static final Pattern TEST_THREAD_NAME_PATTERN =
Pattern.compile("TEST-.+\\.(.+)-seed#\\[.+\\]");
private static final Pattern TEST_SUITE_INIT_THREAD_NAME_PATTERN =

View File

@ -44,7 +44,7 @@ import java.util.Random;
import java.util.Set;
/**
* Base test cluster that exposes the basis to run tests against any elasticsearch cluster, whose layout
* Base test cluster that exposes the basis to run tests against any opensearch cluster, whose layout
* (e.g. number of nodes) is predefined and cannot be changed during the tests execution
*/
public abstract class TestCluster implements Closeable {

View File

@ -62,7 +62,7 @@ import java.util.Set;
/**
* Runs a suite of yaml tests shared with all the official Elasticsearch
* clients against against an elasticsearch cluster.
* clients against against an opensearch cluster.
*
* The suite timeout is extended to account for projects with a large number of tests.
*/

View File

@ -33,7 +33,7 @@ import java.util.List;
/**
* Represents a skip section that tells whether a specific test section or suite needs to be skipped
* based on:
* - the elasticsearch version the tests are running against
* - the opensearch version the tests are running against
* - a specific test feature required that might not be implemented yet by the runner
*/
public class SkipSection {