Exemplo n.º 1
0
async def test_show_tag_values(client):
    r = await client.show_tag_values('host')
    assert r
    logger.debug(r)
    r = await client.show_tag_values('host', 'cpu_load_short')
    assert r
    logger.debug(r)
Exemplo n.º 2
0
async def test_show_field_keys(client):
    r = await client.show_field_keys()
    assert r
    logger.debug(r)
    r = await client.show_field_keys('cpu_load_short')
    assert r
    logger.debug(r)
Exemplo n.º 3
0
def test_placeholder():
    @lineprotocol(placeholder=True)
    @dataclass
    class MyPoint:
        timestamp: aioinflux.TIMEINT

    lp = MyPoint(0).to_lineprotocol()
    logger.debug(lp)
Exemplo n.º 4
0
def test_datetime():
    schema = dict(
        measurement=aioinflux.MEASUREMENT,
        time=aioinflux.TIMEDT,
        host=aioinflux.TAG,
        running=aioinflux.BOOL,
        users=aioinflux.INT,
    )
    MyPoint = lineprotocol(namedtuple('MyPoint', schema.keys()), schema=schema)
    p = MyPoint("a", datetime.utcnow(), "b", False, 5)
    logger.debug(p.to_lineprotocol())
    assert isinstance(p.to_lineprotocol(), bytes)
Exemplo n.º 5
0
def test_rm_none():
    @lineprotocol(rm_none=True)
    class MyPoint(NamedTuple):
        measurement: aioinflux.MEASUREMENT
        time: aioinflux.TIMEINT
        host: aioinflux.TAG
        running: aioinflux.BOOL
        users: aioinflux.INT

    p = MyPoint("a", 2, "b", True, None)
    logger.debug(p.to_lineprotocol())
    assert b'users' not in p.to_lineprotocol()
Exemplo n.º 6
0
def test_rm_none():
    @lineprotocol(rm_none=True)
    class MyPoint(NamedTuple):
        measurement: aioinflux.MEASUREMENT
        time: aioinflux.TIMEINT
        host: aioinflux.TAG
        running: Optional[aioinflux.BOOL]
        users: Optional[aioinflux.INT]

    p1 = MyPoint("a", 2, "b", True, None)
    p2 = MyPoint("a", 2, "b", None, 1)
    logger.debug(p1.to_lineprotocol())
    logger.debug(p2.to_lineprotocol())
    assert b'users' not in p1.to_lineprotocol()
    assert b'running' not in p2.to_lineprotocol()
Exemplo n.º 7
0
async def test_show_continuous_queries(client):
    r = await client.show_continuous_queries()
    assert r
    logger.debug(r)
Exemplo n.º 8
0
async def test_show_retention_policies(client):
    r = await client.show_retention_policies()
    assert r
    logger.debug(r)
Exemplo n.º 9
0
async def test_show_users(client):
    r = await client.show_users()
    assert r
    logger.debug(r)
Exemplo n.º 10
0
async def test_show_measurements(client):
    r = await client.show_measurements()
    assert r
    logger.debug(r)
Exemplo n.º 11
0
async def test_show_databases(client):
    r = await client.show_databases()
    assert r
    logger.debug(r)