コード例 #1
0
async def test_run_discovery():
    wf = discovery.discover_workflow(FIXTURE_TEST_FILE)
    discovery.load_fixtures_from__fixtures__(FIXTURE_TEST_FILE)
    result = await execution.execute(wf)

    assert result["fixture_a"] == "a"
    assert result["fixture_b"] == "ab"
    assert result["fixture_c"] == "c"
    assert result["data_path"]
    assert result["temp_path"]
    assert result["thread_pool_executor"]
    assert result["run_in_executor"]
コード例 #2
0
async def test_updates_sent_to_mongo():
    workflow = discover_workflow(EXAMPLE_WORKFLOW_PATH)

    db = VirtoolDatabase()
    await db._db.jobs.insert_one({"_id": "1"})

    await runtime.execute("1", workflow)

    document = await db._db.jobs.find_one({"_id": "1"})

    updates = [status["update"] for status in document["status"]]

    for update in ("Started up", "Step", "Cleaned up"):
        assert update in updates
コード例 #3
0
async def test_updates_sent_to_mongo():
    with WorkflowFixtureScope() as fixtures:
        name = await fixtures.instantiate(db_name)
        conn = await fixtures.instantiate(db_connection_string)

        db = VirtoolDatabase(name, conn)
        await db._db.jobs.insert_one({"_id": "1"})

    workflow = discover_workflow(EXAMPLE_WORKFLOW_PATH)

    await runtime.execute("1", workflow)

    document = await db._db.jobs.find_one({"_id": "1"})

    updates = [status["update"] for status in document["status"]]

    for update in ("Started up", "Step", "Cleaned up"):
        assert update in updates
コード例 #4
0
def test_discover_workflow():
    workflow = discovery.discover_workflow(TEST_FILE)
    assert isinstance(workflow, Workflow)