-
This unit test will index documents with not existing index:
POST
call to the endpoint/api/notExistIndex/_bulk
with bulkData in body.- Send a request to the server and response would be recorded.
- Using assert.Equal will test if the response code is equal to http.StatusOK (i.e 200),that means test is OK.
-
This unit test will index documents with existing index:
PUT
call to the endpoint/api/index/
with{"name": indexName", "storage_type": "disk"}
in body indexName defined in init.go.- Send a request to the server and response would be recorded and using assert.Equal will test if the response code is equal to http.StatusBadRequest (i.e 400).
- Unmarshal the response and check there is no error using assert.Error method and using assert.Equal to check that the response is equal to index ["+indexName+"] already exists.
POST
call to the endpoint/api/indexName/_bulk
with bulkData in body.- Send a request to the server and response would be recorded.
- Using assert.Equal will test if the response code is equal to http.StatusOK (i.e 200),that means test is OK.
-
This unit test will index bulk document with error input:
POST
call to the endpoint/api/indexName/_bulk
with{"index": {}}
in body.- Send a request to the server and response would be recorded.
- Using assert.Equal will test if the response code is equal to http.StatusOK (i.e 200),that means test is OK.