21 lines
698 B
Python
21 lines
698 B
Python
from lyra_worker.claim import claim_next
|
|
from lyra_worker.pipeline import run_pipeline
|
|
from tests.conftest import insert_request
|
|
|
|
|
|
def test_pipeline_drives_job_to_imported(conn):
|
|
job_id = insert_request(conn)
|
|
claim_next(conn)
|
|
|
|
run_pipeline(conn, job_id, stage_delay=0.0)
|
|
|
|
with conn.cursor() as cur:
|
|
cur.execute('SELECT state, "currentStage" FROM "Job" WHERE id = %s', (job_id,))
|
|
state, stage = cur.fetchone()
|
|
cur.execute('SELECT status FROM "Request" WHERE id = (SELECT "requestId" FROM "Job" WHERE id = %s)', (job_id,))
|
|
req_status = cur.fetchone()[0]
|
|
|
|
assert state == "imported"
|
|
assert stage == "import"
|
|
assert req_status == "completed"
|