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

reordering ml_commons tests : moved test_search to the end #327

Closed
wants to merge 4 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 tasks
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"
Loading