/elasticsearch-document-api-test-suite

Functional tests for ElasticSearch Document API using official Python Elasticsearch Client.

Primary LanguagePython

Elasticsearch Document API functional testing

Table of Contents

About this Project

This test suite perfoms functional testing for ElasticSearch Document API 7.7.0.

Test coverage

CRUD APIs covered by this test suite:

Single document APIs

  • Index
  • Get
  • Delete
  • Update

Multi-document APIs

  • Multi get
  • Bulk
  • Delete by query
  • Update by query API
  • Reindex

Prerequisites

  1. Python 3

Setup of testing environment

  1. Run Elasticsearch locally

This project is tested with Elasticsearch 7.7.0. Set up instructions can be found here. For the purpose of running the test suite one-node cluster is enough. Follow steps 1-3. You now have a single-node Elasticsearch cluster up and running!

  1. Clone this repository and go to folder
git clone https://github.com/kate-tel/elasticsearch-document-api-test-suite.git
cd elasticsearch-document-api-test-suite
  1. Install virtualenv
pip3 install -U pip
pip3 install virtualenv
  1. Create & activate virtual env
virtualenv .venv
source .venv/bin/activate
  1. Install requirements.

As a result, Python Elasticsearch Client 7.8.0 will be installed.

pip3 install -r requirements.txt

Running the tests

  1. To run the tests from the command line:
python -m unittest tests_es_py.py
  1. To run individual test methods:
python -m unittest tests_es_py.ElDocumentAPITest.test_create_doc_with_id

References

  1. Elasticsearch Document API documentation version 7.7.0.

  2. Python Elasticsearch Client API documentation.

  3. Unittest Command-line interface for running the tests