Add test case

This commit is contained in:
Peter J. Holzer 2023-02-04 12:43:04 +01:00 committed by Peter J. Holzer
parent d3a439bb49
commit 3d60e648e4
5 changed files with 42 additions and 0 deletions

View File

@ -0,0 +1,11 @@
{"description": {"fstype": "tmpfs", "hostname": "ehoiai.int.wsr.at", "measure": "time_until_disk_full", "mountpoint": "/run/user/1054", "node": "rorschach.hjp.at", "remote_addr": "", "unit": "s"},
"data": [
[1674806402.1014915, 1000000000.0],
[1674814201.3452954, 1000000000.0],
[1675164602.4004557, 1000000000.0],
[1675165201.6291275, 1000000000.0],
[1675165802.2402072, 1000000000.0],
[1675166401.542857, 1000000000.0],
[1675167002.2809808, 1000000000.0],
[1675167601.2632012, 1000000000.0],
[1675168201.8321788, 1000000000.0]]}

3
pyproject.toml Normal file
View File

@ -0,0 +1,3 @@
[tool.pytest.ini_options]
pythonpath = "."

0
tests/__init__,py Normal file
View File

28
tests/test_timeseries.py Normal file
View File

@ -0,0 +1,28 @@
import pytest
from dashboard import TimeSeries
def test_timeseries_1():
data = {"description": {"fstype": "tmpfs", "hostname": "ehoiai.int.wsr.at", "measure": "time_until_disk_full", "mountpoint": "/run/user/1054", "node": "rorschach.hjp.at", "remote_addr": "", "unit": "s"},
"data": [
[1674806402.1014915, 1000000000.0],
[1674814201.3452954, 1000000000.0],
[1675164602.4004557, 1000000000.0],
[1675165201.6291275, 1000000000.0],
[1675165802.2402072, 1000000000.0],
[1675166401.542857, 1000000000.0],
[1675167002.2809808, 1000000000.0],
[1675167601.2632012, 1000000000.0],
[1675168201.8321788, 1000000000.0]]}
config = {
"type": "timeseries",
"multi": True,
"stops": [ 2592000, 604800, 86400 ],
"data": [
"605da6f41f58b122f41283823a99faa36286961a106ac901bb2b2d730fddc778"
],
"yscale": "log",
}
ts = TimeSeries(config)
graph = ts.graph
assert graph