Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add guidance for writing tests. #39318

Merged
merged 2 commits into from
Mar 1, 2019
Merged

Conversation

jpountz
Copy link
Contributor

@jpountz jpountz commented Feb 22, 2019

This adds more information about how to write tests for Elasticsearch.

@jpountz jpountz added >non-issue :Delivery/Build Build or test infrastructure labels Feb 22, 2019
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

Copy link
Contributor

@jtibshirani jtibshirani left a 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
Copy link
Contributor

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.
Copy link
Contributor

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
Copy link
Contributor

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?

@jpountz jpountz merged commit 985604a into elastic:master Mar 1, 2019
@jpountz jpountz deleted the docs/writing_tests branch March 1, 2019 14:13
jpountz added a commit that referenced this pull request Mar 1, 2019
@mark-vieira mark-vieira added the Team:Delivery Meta label for Delivery team label Nov 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Delivery/Build Build or test infrastructure >non-issue Team:Delivery Meta label for Delivery team v7.2.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants