-
Notifications
You must be signed in to change notification settings - Fork 24.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add guidance for writing tests. #39318
Conversation
Pinging @elastic/es-core-infra |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems really useful, just noted a couple typos I spotted while reading through.
TESTING.asciidoc
Outdated
However it should not be used for coverage. For instance if you are testing a | ||
piece of functionality that enters different code paths depending on whether | ||
the index has 1 shards or 2+ shards, then we shouldn't just test against an | ||
index with a random numder of shards: there should be one test for the 1-shard |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
numder
-> number
TESTING.asciidoc
Outdated
to work in the early days of Elasticsearch. However the complexity of these | ||
tests tends to make them hard to debug. Whenever the functionality that is | ||
being tested isn't intimately dependent on how Elasticsearch behaves as a | ||
cluster, it is recommented to write unit tests or REST tests instead. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
recommented
-> recommended
single node. | ||
- **`ESIntegTestCase`**: An integration test case that creates a cluster that | ||
might have multiple nodes. | ||
- **`ESRestTestCase`**: An integration tests that interacts with an external |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small comment: would it be worth clarifying that this includes YAML tests, as that is a very common way in which REST tests are encountered?
This adds more information about how to write tests for Elasticsearch.