aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_stats.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_stats.py')
-rw-r--r--tests/test_stats.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/test_stats.py b/tests/test_stats.py
new file mode 100644
index 0000000..fad6cc2
--- /dev/null
+++ b/tests/test_stats.py
@@ -0,0 +1,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()