Untitled
unknown
python
3 years ago
5.2 kB
11
Indexable
_____________________________________ ERROR at teardown of TestMediaplan.test_mediaplan_endpoint_rtb_bids _____________________________________
db = <pytests.utils.db.DB object at 0x7feb4feb87c0>, activate_dsp_rtb = {'dsp_id': 2}
prepare_mediaplan = {'timeslot': 'day', 'start_hour': 0, 'end_hour': 23, 'cluster_fields': <pytests.utils.entities.ClusterFields object at...': 3, 'obj_id': 9860665, 'limit': 16932.303144355174, 'counter': <pytests.utils.kvdb.Counter object at 0x7feb4ff8cf10>}
@pytest.fixture(scope="function")
def prepare_mediaplan_endpoint_rtb_bids(db, activate_dsp_rtb, prepare_mediaplan):
"""
"""
Logger().record_exec_order(scope="function", position="begin")
fixture_vars: FixtureVars = prepare_mediaplan
fv = fixture_vars
bid_limit = 386851590
fraction_bids = 0.0000437695064
fv.limit = bid_limit * fraction_bids
ep_id = activate_dsp_rtb.dsp_id
db.query(f"UPDATE `bundle_pool_bundles` SET fraction_bids = {fraction_bids} WHERE "
f"pool_id = {fv.bundle_pool_id} AND bundle_id = {fv.bundle_id}")
introspect.wait_for_adding(table = "bundles",
ids = fv.bundle_id,
column = "bundle_pools",
value = {"poolId": fv.bundle_pool_id,
"fraction_bids": fraction_bids})
db.query(f"INSERT INTO `endpoint_cluster_limits` "
f"(`endpoint_id`, `cluster_id`, `bid_limit`, `imp_limit`, `bid_price`) VALUES "
f"({ep_id}, {fv.cluster_id}, {bid_limit}, 38685159, 0.0)")
introspect.wait_for_adding("endpoint_cluster_limits", dict(endpoint_id = ep_id,
cluster_id = fv.cluster_id))
fv.counter = Counter(endpoint_counters.bids, fv.cluster_id, fv.bundle_id, ep_id)
yield fixture_vars
fv.counter.zero_counter()
db.query(f"DELETE FROM `bundle_pool_bundles` WHERE pool_id = {fv.bundle_pool_id} AND bundle_id = {fv.bundle_id}")
introspect.wait_for_deleting(table = "bundles",
ids = fv.bundle_id,
column = "bundle_pools",
value = {"poolId": fv.bundle_pool_id})
db.query(f"DELETE FROM `endpoint_cluster_limits` WHERE endpoint_id = {ep_id} AND cluster_id = {fv.cluster_id}")
> introspect.wait_for_adding("endpoint_cluster_limits", dict(endpoint_id = ep_id,
cluster_id = fv.cluster_id))
conftest.py:1294:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pytests/utils/introspect.py:355: in wait_for_adding
return handle_errors(result, ExceedTimeout(f"{result}"), strict_handling)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
result = Failure(exceed waiting time: _check_adding elapsed_sec: 20, WarningCode.OBJECT_DOESNT_EXIST)
exception = ExceedTimeout('Failure. error_code: WarningCode.OBJECT_DOESNT_EXIST debug_info: msgs: [\'if column, value and conditio...response_json": {\n "warning": "Model not found . Table \'endpoint_cluster_limits\'"\n }\n }\n} ')
strict_handling = True
def handle_errors(result: Success | Failure,
exception: Exception,
strict_handling: bool):
assert isinstance(exception, Exception), "wrong type of Exception. Must be Exception type"
assert isinstance(strict_handling, bool), "flag strict handling must be bool"
match result:
case Success():
return result
case Failure():
if strict_handling:
> raise exception
E pytests.utils.introspect.ExceedTimeout: Failure. error_code: WarningCode.OBJECT_DOESNT_EXIST debug_info: msgs: ['if column, value and condition is None code must be 200 for success', 'if column, value and condition is None code must be 200 for success', 'exceed waiting time: _check_adding elapsed_sec: 20'],
E info: {
E "wait_for": {
E "elapsed_sec": 20
E },
E "http_code": 404,
E "check_existing": {
E "table": "endpoint_cluster_limits",
E "ids": {
E "endpoint_id": 2,
E "cluster_id": 1
E },
E "response_json": {
E "warning": "Model not found . Table 'endpoint_cluster_limits'"
E }
E }
E }
pytests/utils/result_handling.py:242: ExceedTimeoutEditor is loading...