def datastore_connection(config):
    store = ESStore(config.datastore.hosts)
    ret_val = store.ping()
    if not ret_val:
        pytest.skip("Could not connect to datastore")

    return AssemblylineDatastore(store)
Exemple #2
0
def es_store():
    from assemblyline.datastore.store import ESStore
    store = ESStore(['127.0.0.1'])
    ret_val = store.ping()
    if ret_val:
        return store

    return pytest.skip("Connection to the Elasticsearch server failed. This test cannot be performed...")
Exemple #3
0
def get_datastore(config=None, archive_access=False):
    from assemblyline.datastore.helper import AssemblylineDatastore
    from assemblyline.datastore.store import ESStore

    if not config:
        config = get_config()

    if archive_access:
        return AssemblylineDatastore(
            ESStore(config.datastore.hosts, archive_access=True))
    else:
        return AssemblylineDatastore(
            ESStore(config.datastore.hosts, archive_access=False))
Exemple #4
0
def es_datastore():
    try:
        document_store = setup_store(ESStore(['127.0.0.1']))
    except SetupException:
        document_store = None

    if document_store:
        return document_store

    return pytest.skip("Connection to the Elasticsearch server failed. This test cannot be performed...")
def es_connection(request):
    from assemblyline.datastore.store import ESStore

    try:
        collection = setup_store(ESStore(['127.0.0.1']), request)
    except SetupException:
        collection = None

    if collection:
        return collection

    return pytest.skip(
        "Connection to the Elasticsearch server failed. This test cannot be performed..."
    )