Ejemplo n.º 1
0
def mapi(engine):
    fschema.formula_schema('ns-test-mapi').create(engine)
    fschema.formula_schema('ns-test-mapi-2').create(engine)

    return tsh_api.timeseries(DBURI,
                              namespace='ns-test-mapi',
                              handler=tsio.timeseries,
                              sources=[(DBURI, 'ns-test-mapi-2')])
Ejemplo n.º 2
0
def mapi(engine):
    formula_schema('test-mapi').create(engine)
    formula_schema('test-mapi-2').create(engine)

    return api.timeseries(str(engine.url),
                          namespace='test-mapi',
                          handler=timeseries,
                          sources=[(str(engine.url), 'test-mapi-2')])
Ejemplo n.º 3
0
def engine(request):
    db.setup_local_pg_cluster(request, DATADIR, 5433, {
        'timezone': 'UTC',
        'log_timezone': 'UTC'
    })
    e = create_engine(DBURI)
    sch = tsschema()
    sch.create(e)
    sch = tsschema('other')
    sch.create(e)
    if has_formula():
        from tshistory_formula.schema import formula_schema
        formula_schema().create(e)
        formula_schema('other').create(e)
    return e
Ejemplo n.º 4
0
def mapihttp(engine):
    from tshistory_rest import app
    from tshistory_formula import tsio
    fschema.formula_schema('ns-test-local').create(engine)
    fschema.formula_schema('ns-test-remote').create(engine)
    wsgitester = WebTester(
        app.make_app(tsh_api.timeseries(DBURI, namespace='ns-test-remote')))
    with responses.RequestsMock(assert_all_requests_are_fired=False) as resp:
        with_tester(URI2, resp, wsgitester)

        yield tsh_api.timeseries(DBURI,
                                 namespace='ns-test-local',
                                 handler=tsio.timeseries,
                                 sources=[(URI2, 'ns-test-remote'),
                                          ('http://unavailable',
                                           'ns-test-unavailable-remote')])
Ejemplo n.º 5
0
def engine(request):
    port = 5433
    db.setup_local_pg_cluster(request, DATADIR, port)
    uri = 'postgresql://localhost:{}/postgres'.format(port)
    e = create_engine(uri)
    sch = formula_schema()
    sch.create(e)
    return e
Ejemplo n.º 6
0
def init_db(db_uri, namespace):
    "initialize the formula part of a timeseries history schema"
    engine = create_engine(find_dburi(db_uri))
    formula_schema(namespace).create(engine)
Ejemplo n.º 7
0
def pgapi(engine):
    fschema.formula_schema('tsh').create(engine)
    schema.tsschema('tsh-upstream').create(engine)
    return tsh_api.timeseries(str(engine.url), 'tsh')