test/

directory
v0.3.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 9, 2023 License: Apache-2.0

README

Unit Test Workflows

Setting up the test enviroment (for etcd metadata storage)

  1. Need to install etcd , add root user and enable authentication. You can use this link to setup etcd.
  2. Update the root password in your .env file.
  3. You are good to go.

For boltdb, badger metadata storage

You just need to specify ZINC_METADATA_STORAGE environment variable to "bolt" or "badger" . Default value of ZINC_METADATA_STORAGE is "bolt"

Steps to run tests

  1. A bash script at project root named test.sh can be used to run these unit tests.
cd zinc
./test.sh
  1. If you pass an argument bench then it will run the benchmark test.
./test.sh bench

API Tests

Testing Authentication (Test File : auth_test.go)

  1. Testing Auth API
    1. Testing Authentication with Authorization
    2. Testing Authorization with error Password
    3. Testing Authentication without Authorization
  2. Testing User API
    1. Testing Login with username and password
    2. Testing Login with bad username or password
    3. Testing Create User API
    4. Test Update User
    5. Test Create User with error Input
    6. Test Delete User with existing UserID
    7. Test Delete User with no existing UserID
    8. Test GET User

Test Base API (Test File : base_test.go)

Base API Test
  1. Test Base API
  2. Test Version API
  3. Test Health API
  4. Test User Interface API

Test Document Bulk (Test File : document_bulk_test.go)

  1. Test Bulk Document with Endpoint /api/_bulk
    1. Test Bulk Document Index
    2. Test Bulk Document Delete
    3. Test Bulk Document with error Input
  2. Test Bulk Document with Enpoint /api/:target/_bulk
    1. Test Create Document with not existing Index
    2. Test Create Document with existing Index
    3. Test Bulk Document with error Input

Test Document (Test File: document_test.go)

  1. Test Create Document with Endpoint /api/:target/_doc
    1. Test Create Document with not existing Index
    2. Test Create Document with existing Index
    3. Test Create Document with existing Index and not existing Document ID
    4. Test Update Document with existing Index and existing Document ID
    5. Test Create Document with error Input
  2. Test Update Document with Endpoint /api/:target/_doc/:id
    1. Test Update Document with no existing Index
    2. Test Update Document with existing Index
    3. Test Update Document with existing Index and not existing ID
    4. Test Update Document with existing Index and existing ID
    5. Test Update Document with error Input
  3. Test Delete Document with Endpoint /api/:target/_doc/:id
    1. Test Delete Document with not existing Index
    2. Test Delete Document with existing Index and not existing ID
    3. Test Delete Document with existing Index and existing ID

Test Index (Test File : index_test.go)

  1. Test Index with Endpoint /api/index
    1. Test Create Index with Payload
    2. Test Create Index with error Input
    3. Test GET Index
    4. Test Delete with existing Index
    5. Test Delete with not existing Index
  2. Test Index Mapping with Endpoint /api/:target/_mapping
    1. Test Update mapping for Index
    2. Test GET mappings from Index

Test ElasticSeacrch API (Test File : es_test.go)

  1. Test ES API with Endpoint /es/_bulk
    1. Test Bulk Document Index
    2. Test Bulk Document Delete
    3. Test Bulk Document with error Input
  2. Test ES API with Endpoint /es/:target/_bulk
    1. Test Create Document with no existing Index
    2. Test Create Document with existing Index
    3. Test Bulk with error Input
  3. Test ES API with Endpoint /es/:target/_doc
    1. Test Create Document with not existing Index
    2. Test Create Document with existing Index
    3. Test Create Document with existing Index and not existing Document ID
    4. Test Update Document with existing Index and existing Document ID
    5. Test Create Document with error Input
  4. Test ES API with Endpoint /es/:target/_doc/:id
    1. Test Update Document with no existing Index
    2. Test Update Document with existing Index
    3. Test Create Document with existing Index and not existing ID
    4. Test Update Document with existing Index and existing ID
    5. Test Update Document with error Input
  5. Test ES API with Endpoint /es/:target/_doc/:id
    1. Test Delete Document with not existing Index
    2. Test Delete Document with existing Index and not existing ID
    3. Test Delete Document with existing Index and existing ID
  6. Test ES API with Endpoint /es/:target/_create/:id (PUT)
    1. Test Update Document with no existing Index
    2. Test Update Document with existing Index
    3. Test Update Document with existing Index and not existing ID
    4. Test Update Document with existing Index and existing ID
    5. Test Update Document with error Input
  7. Test ES API with Endpoint /es/:target/_create/:id (POST)
    1. Test Update Document with no existing Index
    2. Test Update Document with existing Index
    3. Test Update Document with existing Index and not existing ID
    4. Test Update Document with existing Index and existing ID
    5. Test Update Document with error Input
  8. Test ES API with Endpoint /es/:target/_update/:id
    1. Test Update Document with no existing Index
    2. Test Update Document with existing Index
    3. Test Update Document with existing Index and not existing ID
    4. Test Update Document with existing Index and existing ID
    5. Test Update Document with error Input

Test Document Searchv1 (Test File : search_v1_test.go)

    1. Test Search Document with no existing Index
    2. Test Search Document with existing Index
    3. Test Search Document with no existing Term
    4. Test Search Document with existing Term
    5. Test Search Document with search type all documents
    6. Test Search Document with search type wildcard
    7. Test Search Document with search type fuzzy
    8. Test Search Document with search type term
    9. Test Search Document with search type data range
    10. Test Search Document with search type match all
    11. Test Search Document with search type match
    12. Test Search Document with search type match phrase
    13. Test Search Document with search type multiphrase
    14. Test Search Document with search type prefix
    15. Test Search Document with search type query string
  1. Test Search Document with Aggregation
    1. Test Search Document with Term Aggregation
    2. Test Search Document with Metric Aggregation

Test Document Searchv2 (Test File : search_v2_test.go)

    1. Test Search Document with no existing Index
    2. Test Search Document with existing Index
    3. Test Search Document with no existing Term
    4. Test Search Document with existing Term
    5. Test Search Document with search type match all
    6. Test Search Document with search type wildcard
    7. Test Search Document with search type fuzzy
    8. Test Search Document with search type term
    9. Test Search Document with search type data range
    10. Test Search Document with search type match
    11. Test Search Document with search type match phrase
    12. Test Search Document with search type prefix
    13. Test Search Document with search type query string
  1. Test Search Document with Aggregation
    1. Test Search Document with Term Aggregation
    2. Test Search Document with Metric Aggregation

Test Analyzers (Test File : analyze_test.go)

  1. Test Analyzers
  2. Test Tokenizers
  3. Test Token Filter

Benchmark Test

Test Benchmark (Test File : bulk_test.go)

  1. Test Bulk Worker Function

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL