Skip to content

Commit

Permalink
reordering ml_commons tests : moved test_search to the end (#330)
Browse files Browse the repository at this point in the history
* move test-search to the end

Signed-off-by: kalyan <[email protected]>

* fix lint

Signed-off-by: kalyan <[email protected]>

---------

Signed-off-by: kalyan <[email protected]>
  • Loading branch information
rawwar authored Nov 2, 2023
1 parent 5ca5aa8 commit da415f0
Showing 1 changed file with 94 additions and 97 deletions.
191 changes: 94 additions & 97 deletions tests/ml_commons/test_ml_commons_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,102 +100,6 @@ def test_execute():
), "Raised Exception during execute API testing with JSON string"


def test_search():
# Search task cases
raised = False
try:
search_task_obj = ml_client.search_task(
input_json='{"query": {"match_all": {}},"size": 1}'
)
assert search_task_obj["hits"]["hits"] != []
except: # noqa: E722
raised = True
assert raised == False, "Raised Exception in searching task"

raised = False
try:
search_task_obj = ml_client.search_task(
input_json={"query": {"match_all": {}}, "size": 1}
)
assert search_task_obj["hits"]["hits"] != []
except: # noqa: E722
raised = True
assert raised == False, "Raised Exception in searching task"

raised = False
try:
search_task_obj = ml_client.search_task(input_json=15)
assert search_task_obj == "Invalid JSON object passed as argument."
except: # noqa: E722
raised = True
assert raised == False, "Raised Exception in searching task"

raised = False
try:
search_task_obj = ml_client.search_task(input_json="15")
assert search_task_obj == "Invalid JSON object passed as argument."
except: # noqa: E722
raised = True
assert raised == False, "Raised Exception in searching task"

raised = False
try:
search_task_obj = ml_client.search_task(
input_json='{"query": {"match_all": {}},size: 1}'
)
assert search_task_obj == "Invalid JSON string passed as argument."
except: # noqa: E722
raised = True
assert raised == False, "Raised Exception in searching task"

# Search model cases
raised = False
try:
search_model_obj = ml_client.search_model(
input_json='{"query": {"match_all": {}},"size": 1}'
)
assert search_model_obj["hits"]["hits"] != []
except: # noqa: E722
raised = True
assert raised == False, "Raised Exception in searching model"

raised = False
try:
search_model_obj = ml_client.search_model(
input_json={"query": {"match_all": {}}, "size": 1}
)
assert search_model_obj["hits"]["hits"] != []
except: # noqa: E722
raised = True
assert raised == False, "Raised Exception in searching model"

raised = False
try:
search_model_obj = ml_client.search_model(input_json=15)
assert search_model_obj == "Invalid JSON object passed as argument."
except: # noqa: E722
raised = True
assert raised == False, "Raised Exception in searching model"

raised = False
try:
search_model_obj = ml_client.search_model(input_json="15")
assert search_model_obj == "Invalid JSON object passed as argument."
except: # noqa: E722
raised = True
assert raised == False, "Raised Exception in searching model"

raised = False
try:
search_model_obj = ml_client.search_model(
input_json='{"query": {"match_all": {}},size: 1}'
)
assert search_model_obj == "Invalid JSON string passed as argument."
except: # noqa: E722
raised = True
assert raised == False, "Raised Exception in searching model"


def test_DEPRECATED_integration_pretrained_model_upload_unload_delete():
raised = False
try:
Expand Down Expand Up @@ -515,4 +419,97 @@ def test_integration_model_train_register_full_cycle():
assert raised == False, "Raised Exception in deleting model"


test_integration_model_train_register_full_cycle()
def test_search():
# Search task cases
raised = False
try:
search_task_obj = ml_client.search_task(
input_json='{"query": {"match_all": {}},"size": 1}'
)
assert search_task_obj["hits"]["hits"] != []
except: # noqa: E722
raised = True
assert raised == False, "Raised Exception in searching task"

raised = False
try:
search_task_obj = ml_client.search_task(
input_json={"query": {"match_all": {}}, "size": 1}
)
assert search_task_obj["hits"]["hits"] != []
except: # noqa: E722
raised = True
assert raised == False, "Raised Exception in searching task"

raised = False
try:
search_task_obj = ml_client.search_task(input_json=15)
assert search_task_obj == "Invalid JSON object passed as argument."
except: # noqa: E722
raised = True
assert raised == False, "Raised Exception in searching task"

raised = False
try:
search_task_obj = ml_client.search_task(input_json="15")
assert search_task_obj == "Invalid JSON object passed as argument."
except: # noqa: E722
raised = True
assert raised == False, "Raised Exception in searching task"

raised = False
try:
search_task_obj = ml_client.search_task(
input_json='{"query": {"match_all": {}},size: 1}'
)
assert search_task_obj == "Invalid JSON string passed as argument."
except: # noqa: E722
raised = True
assert raised == False, "Raised Exception in searching task"

# Search model cases
raised = False
try:
search_model_obj = ml_client.search_model(
input_json='{"query": {"match_all": {}},"size": 1}'
)
assert search_model_obj["hits"]["hits"] != []
except: # noqa: E722
raised = True
assert raised == False, "Raised Exception in searching model"

raised = False
try:
search_model_obj = ml_client.search_model(
input_json={"query": {"match_all": {}}, "size": 1}
)
assert search_model_obj["hits"]["hits"] != []
except: # noqa: E722
raised = True
assert raised == False, "Raised Exception in searching model"

raised = False
try:
search_model_obj = ml_client.search_model(input_json=15)
assert search_model_obj == "Invalid JSON object passed as argument."
except: # noqa: E722
raised = True
assert raised == False, "Raised Exception in searching model"

raised = False
try:
search_model_obj = ml_client.search_model(input_json="15")
assert search_model_obj == "Invalid JSON object passed as argument."
except: # noqa: E722
raised = True
assert raised == False, "Raised Exception in searching model"

raised = False
try:
search_model_obj = ml_client.search_model(
input_json='{"query": {"match_all": {}},size: 1}'
)
assert search_model_obj == "Invalid JSON string passed as argument."
except: # noqa: E722
raised = True
assert raised == False, "Raised Exception in searching model"

0 comments on commit da415f0

Please sign in to comment.