summaryrefslogtreecommitdiffstats
path: root/lang/python/python-influxdb/test.sh
blob: 8397418a08607ed5f05b8c3aa5c12217011d508d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/sh

[ "$1" = python3-influxdb ] || exit 0

python3 - << 'EOF'
from influxdb import DataFrameClient, InfluxDBClient
from influxdb.line_protocol import make_lines

# Test line protocol generation (no server needed)
data = [
    {
        "measurement": "cpu",
        "tags": {"host": "server01"},
        "fields": {"value": 0.64},
    }
]
line = make_lines({"points": data}).strip()
assert line.startswith("cpu,host=server01"), f"Unexpected line: {line}"
assert "value=0.64" in line

# Test client instantiation (no connection)
client = InfluxDBClient(host="localhost", port=8086, database="testdb")
assert client._host == "localhost"
assert client._port == 8086
EOF