summaryrefslogtreecommitdiffstats
path: root/src/test/pybind/test_cephfs.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-23 16:45:17 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-23 16:45:44 +0000
commit17d6a993fc17d533460c5f40f3908c708e057c18 (patch)
tree1a3bd93e0ecd74fa02f93a528fe2f87e5314c4b5 /src/test/pybind/test_cephfs.py
parentReleasing progress-linux version 18.2.2-0progress7.99u1. (diff)
downloadceph-17d6a993fc17d533460c5f40f3908c708e057c18.tar.xz
ceph-17d6a993fc17d533460c5f40f3908c708e057c18.zip
Merging upstream version 18.2.3.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/pybind/test_cephfs.py')
-rw-r--r--src/test/pybind/test_cephfs.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/test/pybind/test_cephfs.py b/src/test/pybind/test_cephfs.py
index d16807de9..247ddca37 100644
--- a/src/test/pybind/test_cephfs.py
+++ b/src/test/pybind/test_cephfs.py
@@ -10,6 +10,7 @@ import random
import time
import stat
import uuid
+import json
from datetime import datetime
cephfs = None
@@ -907,3 +908,35 @@ def test_snapdiff(testdir):
# remove directory
purge_dir(b"/snapdiff_test");
+
+def test_single_target_command():
+ command = {'prefix': u'session ls', 'format': 'json'}
+ mds_spec = "a"
+ inbuf = b''
+ ret, outbl, outs = cephfs.mds_command(mds_spec, json.dumps(command), inbuf)
+ if outbl:
+ session_map = json.loads(outbl)
+ # Standby MDSs will return -38
+ assert(ret == 0 or ret == -38)
+
+def test_multi_target_command():
+ mds_get_command = {'prefix': 'status', 'format': 'json'}
+ inbuf = b''
+ ret, outbl, outs = cephfs.mds_command('*', json.dumps(mds_get_command), inbuf)
+ print(outbl)
+ mds_status = json.loads(outbl)
+ print(mds_status)
+
+ command = {'prefix': u'session ls', 'format': 'json'}
+ mds_spec = "*"
+ inbuf = b''
+
+ ret, outbl, outs = cephfs.mds_command(mds_spec, json.dumps(command), inbuf)
+ # Standby MDSs will return -38
+ assert(ret == 0 or ret == -38)
+ print(outbl)
+ session_map = json.loads(outbl)
+
+ if isinstance(mds_status, list): # if multi target command result
+ for mds_sessions in session_map:
+ assert(list(mds_sessions.keys())[0].startswith('mds.'))