Skip to content

Commit 1740517

Browse files
authored
Cleanup TESTING and DEVELOPER_GUIDE markdowns (#946) (#954)
1 parent c63071b commit 1740517

File tree

6 files changed

+45
-44
lines changed

6 files changed

+45
-44
lines changed

CONTRIBUTING.md

+11-5
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,16 @@ Contributing to OpenSearch
44
OpenSearch is a community project that is built and maintained by people just like **you**. We're glad you're interested in helping out. There are several different ways you can do it, but before we talk about that, let's talk about how to get started.
55

66
## Table of Contents:
7-
- [First Things First](#first-things-first)
8-
- [Ways to Contribute](#ways-to-contribute)
9-
- [Developer Certificate of Origin](#developer-certificate-of-origin)
10-
- [Review Process](#review-process)
7+
- [Contributing to OpenSearch](#contributing-to-opensearch)
8+
- [Table of Contents:](#table-of-contents)
9+
- [First Things First](#first-things-first)
10+
- [Ways to Contribute](#ways-to-contribute)
11+
- [Bug Reports](#bug-reports)
12+
- [Feature Requests](#feature-requests)
13+
- [Documentation Changes](#documentation-changes)
14+
- [Contributing Code](#contributing-code)
15+
- [Developer Certificate of Origin](#developer-certificate-of-origin)
16+
- [Review Process](#review-process)
1117

1218

1319
## First Things First
@@ -52,7 +58,7 @@ If you've thought of a way that OpenSearch could be better, we want to hear abou
5258

5359
### Documentation Changes
5460

55-
If you would like to contribute to the documentation, please see [OpenSearch Docs repo](https://github.com/opensearch-project/documentation-website/blob/main/README.md).
61+
If you would like to contribute to the documentation, please do so in the [documentation-website](https://github.com/opensearch-project/documentation-website) repo. To contribute javadocs, please first check [OpenSearch#221](https://github.com/opensearch-project/OpenSearch/issues/221).
5662

5763
### Contributing Code
5864

DEVELOPER_GUIDE.md

+23-20
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,39 @@
22

33
So you want to contribute code to OpenSearch? Excellent! We're glad you're here. Here's what you need to do.
44

5-
- [Getting Started](#getting-started)
5+
- [Developer Guide](#developer-guide)
6+
- [Getting Started](#getting-started)
67
- [Git Clone OpenSearch Repo](#git-clone-opensearch-repo)
78
- [Install Prerequisites](#install-prerequisites)
9+
- [JDK 14](#jdk-14)
10+
- [Docker](#docker)
811
- [Run Tests](#run-tests)
912
- [Run OpenSearch](#run-opensearch)
10-
- [Use an Editor](#use-an-editor)
13+
- [Use an Editor](#use-an-editor)
1114
- [IntelliJ IDEA](#intellij-idea)
1215
- [Visual Studio Code](#visual-studio-code)
1316
- [Eclipse](#eclipse)
14-
- [Project Layout](#project-layout)
15-
- [docs](#docs)
16-
- [distribution](#distribution)
17-
- [libs](#libs)
18-
- [modules](#modules)
19-
- [plugins](#plugins)
20-
- [qa](#qa)
21-
- [server](#server)
22-
- [test](#test)
23-
- [Java Language Formatting Guidelines](#java-language-formatting-guidelines)
17+
- [Project Layout](#project-layout)
18+
- [`distribution`](#distribution)
19+
- [`libs`](#libs)
20+
- [`modules`](#modules)
21+
- [`plugins`](#plugins)
22+
- [`qa`](#qa)
23+
- [`server`](#server)
24+
- [`test`](#test)
25+
- [Java Language Formatting Guidelines](#java-language-formatting-guidelines)
2426
- [Editor / IDE Support](#editor--ide-support)
2527
- [Formatting Failures](#formatting-failures)
26-
- [Gradle Build](#gradle-build)
28+
- [Gradle Build](#gradle-build)
2729
- [Configurations](#configurations)
28-
- [Misc](#misc)
30+
- [implementation](#implementation)
31+
- [api](#api)
32+
- [runtimeOnly](#runtimeonly)
33+
- [compileOnly](#compileonly)
34+
- [testImplementation](#testimplementation)
35+
- [Misc](#misc)
2936
- [git-secrets](#git-secrets)
30-
- [Submitting Changes](#submitting-changes)
37+
- [Submitting Changes](#submitting-changes)
3138

3239
## Getting Started
3340

@@ -156,10 +163,6 @@ We would like to support Eclipse, but few of us use it and has fallen into disre
156163

157164
This repository is split into many top level directories. The most important ones are:
158165

159-
### `docs`
160-
161-
Documentation for the project.
162-
163166
### `distribution`
164167

165168
Builds our tar and zip archives and our rpm and deb packages.
@@ -177,7 +180,7 @@ For example, reindex requires the `connect` permission so it can perform reindex
177180

178181
### `plugins`
179182

180-
Officially supported plugins to OpenSearch. We decide that a feature should be a plugin rather than shipped as a module because we feel that it is only important to a subset of users, especially if it requires extra dependencies.
183+
OpenSearch plugins. We decide that a feature should be a plugin rather than shipped as a module because we feel that it is only important to a subset of users, especially if it requires extra dependencies.
181184

182185
The canonical example of this is the ICU analysis plugin. It is important for folks who want the fairly language neutral ICU analyzer but the library to implement the analyzer is 11MB so we don't ship it with OpenSearch by default.
183186

TESTING.md

+9-16
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,14 @@ OpenSearch uses [jUnit](https://junit.org/junit5/) for testing, it also uses ran
3434
- [Test coverage analysis](#test-coverage-analysis)
3535
- [Building with extra plugins](#building-with-extra-plugins)
3636
- [Environment misc](#environment-misc)
37-
- [Benchmarking](#benchmarking)
3837

3938
# Requirements
4039

4140
You will need the following pieces of software to run these tests:
4241

4342
- Docker & Docker Compose
4443
- Vagrant
45-
- JDK 14
44+
- JDK 11
4645
- Gradle
4746

4847
# Creating packages
@@ -368,13 +367,13 @@ A specific version can be tested as well. For example, to test bwc with version
368367

369368
./gradlew v5.3.2#bwcTest
370369

371-
Use -Dtest.class and -Dtests.method to run a specific bwcTest test. For example to run a specific tests from the x-pack rolling upgrade from 7.7.0:
370+
Use -Dtest.class and -Dtests.method to run a specific bwcTest test. For example to test a rolling upgrade from 7.7.0:
372371

373-
./gradlew :x-pack:qa:rolling-upgrade:v7.7.0#bwcTest \
374-
-Dtests.class=org.opensearch.upgrades.UpgradeClusterClientYamlTestSuiteIT \
375-
-Dtests.method="test {p0=*/40_ml_datafeed_crud/*}"
372+
./gradlew :qa:rolling-upgrade:v7.7.0#bwcTest \
373+
-Dtests.class=org.opensearch.upgrades.RecoveryIT \
374+
-Dtests.method=testHistoryUUIDIsGenerated
376375

377-
Tests are run for versions that are not yet released but with which the current version will be compatible with. These are automatically checked out and built from source. See [VersionCollection](./buildSrc/src/main/java/org/opensearch/gradle/VersionCollection.java) and [distribution/bwc/build.gradle](./distribution/bwc/build.gradle) for more information.
376+
Tests are run for versions that are not yet released but with which the current version will be compatible with. These are automatically checked out and built from source. See [BwcVersions](./buildSrc/src/main/java/org/opensearch/gradle/BwcVersions.java) and [distribution/bwc/build.gradle](./distribution/bwc/build.gradle) for more information.
378377

379378
When running `./gradlew check`, minimal bwc checks are also run against compatible versions that are not yet released.
380379

@@ -420,7 +419,7 @@ In short, most new functionality should come with unit tests, and optionally RES
420419

421420
### Refactor code to make it easier to test
422421

423-
Unfortunately, a large part of our code base is still hard to unit test. Sometimes because some classes have lots of dependencies that make them hard to instantiate. Sometimes because API contracts make tests hard to write. Code refactors that make functionality easier to unit test are encouraged. If this sounds very abstract to you, you can have a look at [this pull request](https://github.com/elastic/elasticsearch/pull/16610) for instance, which is a good example. It refactors `IndicesRequestCache` in such a way that: - it no longer depends on objects that are hard to instantiate such as `IndexShard` or `SearchContext`, - time-based eviction is applied on top of the cache rather than internally, which makes it easier to assert on what the cache is expected to contain at a given time.
422+
Unfortunately, a large part of our code base is still hard to unit test. Sometimes because some classes have lots of dependencies that make them hard to instantiate. Sometimes because API contracts make tests hard to write. Code refactors that make functionality easier to unit test are encouraged.
424423

425424
## Bad practices
426425

@@ -438,13 +437,11 @@ Multi-threaded tests are often not reproducible due to the fact that there is no
438437

439438
Generating test coverage reports for OpenSearch is currently not possible through Gradle. However, it *is* possible to gain insight in code coverage using IntelliJ’s built-in coverage analysis tool that can measure coverage upon executing specific tests. Eclipse may also be able to do the same using the EclEmma plugin.
440439

441-
Test coverage reporting used to be possible with JaCoCo when OpenSearch was using Maven as its build system. Since the switch to Gradle though, this is no longer possible, seeing as the code currently used to build OpenSearch does not allow JaCoCo to recognize its tests. For more information on this, see the discussion in [issue #28867](https://github.com/elastic/elasticsearch/issues/28867).
442-
443-
Read your IDE documentation for how to attach a debugger to a JVM process.
440+
Please read your IDE documentation for how to attach a debugger to a JVM process.
444441

445442
# Building with extra plugins
446443

447-
Additional plugins may be built alongside OpenSearch, where their dependency on OpenSearch will be substituted with the local OpenSearch build. To add your plugin, create a directory called opensearch-extra as a sibling of OpenSearch. Checkout your plugin underneath opensearch-extra and the build will automatically pick it up. You can verify the plugin is included as part of the build by checking the projects of the build.
444+
Additional plugins may be built alongside OpenSearch, where their dependency on OpenSearch will be substituted with the local OpenSearch build. To add your plugin, create a directory called `opensearch-extra` as a sibling of OpenSearch. Checkout your plugin underneath `opensearch-extra` and the build will automatically pick it up. You can verify the plugin is included as part of the build by checking the projects of the build.
448445

449446
./gradlew projects
450447

@@ -455,7 +452,3 @@ There is a known issue with macOS localhost resolve strategy that can cause some
455452
127.0.0.1 localhost OpenSearchMBP.local
456453
255.255.255.255 broadcasthost
457454
::1 localhost OpenSearchMBP.local`
458-
459-
# Benchmarking
460-
461-
For changes that might affect the performance characteristics of OpenSearch you should also run macrobenchmarks. There is also a macrobenchmarking tool called [Rally](https://github.com/elastic/rally) which you can use to measure the performance impact. To get started, please see [Rally’s documentation](https://esrally.readthedocs.io/en/stable/).

buildSrc/version.properties

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ joda = 2.10.4
2626
# when updating this version, you need to ensure compatibility with:
2727
# - plugins/ingest-attachment (transitive dependency, check the upstream POM)
2828
# - distribution/tools/plugin-cli
29-
# - x-pack/plugin/security
3029
bouncycastle=1.64
3130
# test dependencies
3231
randomizedrunner = 2.7.1

qa/translog-policy/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ apply from : "$rootDir/gradle/bwc-test.gradle"
4040
for (Version bwcVersion : BuildParams.bwcVersions.indexCompatible) {
4141
if (bwcVersion.before('6.3.0')) {
4242
// explicitly running restart on the current node does not work in step 2
43-
// below when plugins are installed, wihch is the case for x-pack as a plugin
43+
// below when plugins are installed, which is the case for some plugins
4444
// prior to 6.3.0
4545
continue
4646
}

server/src/main/java/org/opensearch/cluster/metadata/IndexNameExpressionResolver.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ private static boolean addIndex(IndexMetadata metadata, Context context) {
362362
// trappy to hide throttled indices by default. In order to avoid breaking backward compatibility,
363363
// we changed it to look at the `index.frozen` setting instead, since frozen indices were the only
364364
// type of index to use the `search_throttled` threadpool at that time.
365-
// NOTE: We can't reference the Setting object, which is only defined and registered in x-pack.
365+
// NOTE: The Setting object was defined in an external plugin prior to OpenSearch fork.
366366
return (context.options.ignoreThrottled() && metadata.getSettings().getAsBoolean("index.frozen", false)) == false;
367367
}
368368

0 commit comments

Comments
 (0)