Details
-
Sub-task
-
Resolution: Done
-
Major
-
None
-
None
-
None
-
None
Description
Error Message
AssertionError: assert False + where False = deep_dict_compare(
{'code': 'CM/AUV/01/1700229', 'controller': '', 'createdby': 'office04', 'dateofpurchase': '2017-11-06T00: 00: 00', ...},
{'code': 'CM/AUV/01/1700229', 'controller': '', 'createdby': 'office04', 'dateofpurchase': '2017-11-06T00: 00: 00', ...}, True)
Stacktrace
params_from_base_test_setup =
{'base_url': 'http://10.100.172.58:8080', 'cbl_ce': False, 'cbl_db': 'cbl-test1598662402.1010711', 'cbl_log_decoder_build': None, ...}doc_generator_type = 'complex_doc'
@pytest.mark.listener
@pytest.mark.parametrize(
'doc_generator_type',
[
pytest.param('four_k', marks=pytest.mark.sanity),
('simple_user'),
('complex_doc'),
('simple')
]
)
def test_predictiveQueries_basicInputOutput(params_from_base_test_setup, doc_generator_type):
'''
@summary:
1. Register the model
2. Create bulk docs with differrent types of dictionaries
3. Get the prediction query result and verify whatever the dictionary input is given,
it should send back same result
4. Verify that prediction query throws error when invalid input is provided
'''
base_url = params_from_base_test_setup["base_url"]
db = params_from_base_test_setup["db"]
cbl_db = params_from_base_test_setup["source_db"]
sg_config = params_from_base_test_setup["sg_config"]
cluster_config = params_from_base_test_setup["cluster_config"]
liteserv_version = params_from_base_test_setup["liteserv_version"]
if liteserv_version < "2.5.0":
pytest.skip('This test cannnot run with CBL version below 2.5')
- Reset cluster to ensure no data in system
c = cluster.Cluster(config=cluster_config)
c.reset(sg_config_path=sg_config)
- Register model
modelName = "EchoModel"
predictive_query = PredictiveQueries(base_url)
model = predictive_query.registerModel(modelName)
- Create dictionary and get the prediction query
if doc_generator_type == "four_k":
doc_body = doc_generators.four_k()
elif doc_generator_type == "simple_user":
doc_body = doc_generators.simple_user()
elif doc_generator_type == "complex_doc":
doc_body = doc_generators.complex_doc()
else:
doc_body = doc_generators.simple()
total_docs = 2
db.create_bulk_docs(total_docs, "cbl-predictive", db=cbl_db, generator=doc_generator_type)
result_set = predictive_query.getPredictionQueryResult(model, doc_body, cbl_db)
assert total_docs == len(result_set), "expected number of docs is {}, the actual number of docs is {}".format(total_docs, len(result_set))
for result in result_set:
'''
call deep_dict_compare with isPredictiveResult enabled flag
this flag allows large numbers do approximate comparison instead of precise comparison.
'''
> assert deep_dict_compare(doc_body, result[list(result.keys())[0]], True)
E AssertionError: assert False
E + where False = deep_dict_compare(
,
{'code': 'CM/AUV/01/1700229', 'controller': '', 'createdby': 'office04', 'dateofpurchase': '2017-11-06T00: 00: 00', ...}, True)
testsuites/CBLTester/CBL_Functional_tests/TestSetup_FunctionalTests/test_predective_queries.py:68: AssertionError