Skip to content

Commit b693cff

Browse files
authored
Merge pull request #1735 from gbregman/devel
Add a test for "gateway get_thread_stats" CLI command.
2 parents 0cf969e + 0d79951 commit b693cff

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

tests/test_cli.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,38 @@ def test_get_gateway_stats(self, caplog, gateway):
246246
assert '"completed_nvme_io": "0"' in caplog.text
247247
assert '"trtype": "TCP"' in caplog.text
248248

249+
def test_get_gateway_thread_stats(self, caplog, gateway):
250+
caplog.clear()
251+
cli(["--format", "json", "gateway", "get_thread_stats"])
252+
assert '"status": 0' in caplog.text
253+
assert '"tick_rate": "' in caplog.text
254+
assert '"tick_rate": "0' not in caplog.text
255+
assert '"threads": [' in caplog.text
256+
assert '"threads": []' not in caplog.text
257+
assert '"name": "app_thread"' in caplog.text
258+
if os.cpu_count() >= 4:
259+
assert '"name": "nvmf_tgt_poll_group_000"' in caplog.text
260+
assert '"name": "nvmf_tgt_poll_group_001"' in caplog.text
261+
assert '"name": "nvmf_tgt_poll_group_002"' in caplog.text
262+
assert '"name": "nvmf_tgt_poll_group_003"' in caplog.text
263+
assert '"name": "nvmf_tgt_poll_group_004"' not in caplog.text
264+
elif os.cpu_count() == 3:
265+
assert '"name": "nvmf_tgt_poll_group_000"' in caplog.text
266+
assert '"name": "nvmf_tgt_poll_group_001"' in caplog.text
267+
assert '"name": "nvmf_tgt_poll_group_002"' in caplog.text
268+
assert '"name": "nvmf_tgt_poll_group_003"' not in caplog.text
269+
elif os.cpu_count() == 2:
270+
assert '"name": "nvmf_tgt_poll_group_000"' in caplog.text
271+
assert '"name": "nvmf_tgt_poll_group_001"' in caplog.text
272+
assert '"name": "nvmf_tgt_poll_group_002"' not in caplog.text
273+
else:
274+
assert '"name": "nvmf_tgt_poll_group_000"' in caplog.text
275+
assert '"name": "nvmf_tgt_poll_group_001"' not in caplog.text
276+
assert '"busy": "' in caplog.text
277+
assert '"busy": "0' not in caplog.text
278+
assert '"idle": "' in caplog.text
279+
assert '"idle": "0' not in caplog.text
280+
249281
def test_message_length_too_long(self, caplog, gateway):
250282
caplog.clear()
251283
try:

0 commit comments

Comments
 (0)