test: Fix flaky tests (allow empty dicts for list plugins)

This commit is contained in:
Ambika Patidar committed 2026-02-07 12:22:07 +05:30
1 parent 64d0114b00
commit 4c92e1b6e6
1 file changed
+4 -3
+4 -3
View File
@@ -143,14 +143,15 @@ class TestGlances(unittest.TestCase):
'vms',
'npu',
):
if isinstance(req.json(), dict) and not req.json():
# Specific case for plugins that can be empty on VM (like sensors, containers...)
# They return an empty dict instead of an empty list
continue
self.assertIsInstance(req.json(), list)
if len(req.json()) > 0:
self.assertIsInstance(req.json()[0], dict)
else:
self.assertIsInstance(req.json(), dict)
# Specific case for sensors (can be empty on VM)
if p == 'sensors' and req.json() == {}:
continue
def test_004_items(self):
"""Items."""