Example #1
0
async def test_update_contact_no_contact_data(data_store_mgr: DataStoreMgr):
    """Updating contact with no contact data results in default values
    for the workflow in the data store, like the API version set to zero."""
    w_id = 'user|workflow_id'
    api_version = 0
    await data_store_mgr.register_workflow(w_id=w_id)
    data_store_mgr.update_contact(w_id=w_id, contact_data=None)
    assert api_version == data_store_mgr.data[w_id]['workflow'].api_version
Example #2
0
async def test_update_contact_with_contact_data(data_store_mgr: DataStoreMgr):
    """Updating contact with contact data sets the values int he data store
    for the workflow."""
    w_id = 'user|workflow_id'
    api_version = 1
    await data_store_mgr.register_workflow(w_id=w_id)
    contact_data = {
        'name': 'workflow_id',
        'owner': 'cylc',
        CFF.HOST: 'localhost',
        CFF.PORT: 40000,
        CFF.API: api_version
    }
    data_store_mgr.update_contact(w_id=w_id, contact_data=contact_data)
    assert api_version == data_store_mgr.data[w_id]['workflow'].api_version
Example #3
0
async def test_stop_workflow(data_store_mgr: DataStoreMgr):
    """Telling a data store to stop a workflow, is the same as updating
    contact with no contact data."""
    w_id = 'user|workflow_id'
    api_version = 1
    await data_store_mgr.register_workflow(w_id=w_id)
    contact_data = {
        'name': 'workflow_id',
        'owner': 'cylc',
        CFF.HOST: 'localhost',
        CFF.PORT: 40000,
        CFF.API: api_version
    }
    data_store_mgr.update_contact(w_id=w_id, contact_data=contact_data)
    assert api_version == data_store_mgr.data[w_id]['workflow'].api_version

    data_store_mgr.stop_workflow(w_id=w_id)
    assert data_store_mgr.data[w_id]['workflow'].api_version == 0