blob: fad6cc2186b55c9b825183d52d4caa3eabe0a391 (
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
|
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
import unittest
import deckit.modules.stats as stats
class Stats(unittest.TestCase):
def test_state_shape(self):
st = stats.make({}).state()
for key in ("cpu", "memUsed", "memTotal", "net", "uptime", "host"):
self.assertIn(key, st)
self.assertIsInstance(st["cpu"], int)
def test_build_discovers_stats(self):
from deckit.modules import build
names = [m["name"] for m in build({"modules": {}}).names()]
self.assertIn("stats", names)
if __name__ == "__main__":
unittest.main()
|