feat(scada): add calibrated monitoring and incident recovery
This commit is contained in:
@@ -33,13 +33,12 @@ class Connection:
|
||||
return Cursor()
|
||||
|
||||
|
||||
def test_status_projection_excludes_result_and_expires_without_worker():
|
||||
def test_status_projection_excludes_result_and_scrubs_expired_payloads():
|
||||
connection = Connection()
|
||||
repo = CalculationJobRepository(connection, 'project')
|
||||
asyncio.run(repo.get('job'))
|
||||
assert 'QUEUE_TIMEOUT' in connection.statements[0][0]
|
||||
assert 'SET result=NULL' in connection.statements[1][0]
|
||||
assert ',result FROM' not in connection.statements[2][0]
|
||||
assert 'SET result=NULL' in connection.statements[0][0]
|
||||
assert ',result FROM' not in connection.statements[1][0]
|
||||
asyncio.run(repo.get('job', include_result=True))
|
||||
assert ',result FROM' in connection.statements[-1][0]
|
||||
|
||||
@@ -55,6 +54,15 @@ def test_duplicate_submission_bypasses_full_queue_inside_transaction():
|
||||
assert not any('count(*)' in sql for sql, _, _ in connection.statements)
|
||||
|
||||
|
||||
def test_new_jobs_have_no_queue_expiry_contract():
|
||||
connection = Connection([None, {'active': 0}, {'job_id': 'new'}])
|
||||
asyncio.run(CalculationJobRepository(connection, 'project').enqueue(
|
||||
owner_user_id='owner', request_key='key', tool='tool', parameters={},
|
||||
binding={}, timeout_seconds=30))
|
||||
insert = next(sql for sql, _, _ in connection.statements if 'INSERT INTO' in sql)
|
||||
assert 'queue_expires_at' not in insert
|
||||
|
||||
|
||||
def test_capacity_rejects_new_job_before_insert():
|
||||
connection = Connection([None, {'active': 100}])
|
||||
with pytest.raises(CalculationCapacityExceeded):
|
||||
|
||||
Reference in New Issue
Block a user