diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-23 16:45:17 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-23 16:45:44 +0000 |
commit | 17d6a993fc17d533460c5f40f3908c708e057c18 (patch) | |
tree | 1a3bd93e0ecd74fa02f93a528fe2f87e5314c4b5 /src/test/pybind | |
parent | Releasing progress-linux version 18.2.2-0progress7.99u1. (diff) | |
download | ceph-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 '')
-rw-r--r-- | src/test/pybind/test_cephfs.py | 33 | ||||
-rw-r--r-- | src/test/pybind/test_rbd.py | 24 |
2 files changed, 56 insertions, 1 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.')) diff --git a/src/test/pybind/test_rbd.py b/src/test/pybind/test_rbd.py index 7b5f31b57..df47b0d29 100644 --- a/src/test/pybind/test_rbd.py +++ b/src/test/pybind/test_rbd.py @@ -415,6 +415,18 @@ def test_remove_canceled(tmp_image): assert_raises(OperationCanceled, RBD().remove, ioctx, image_name, on_progress=progress_cb) +def test_remove_with_progress_except(): + create_image() + d = {'received_callback': False} + def progress_cb(current, total): + d['received_callback'] = True + raise Exception() + + # exception is logged and ignored with a Cython warning: + # Exception ignored in: 'rbd.progress_callback' + RBD().remove(ioctx, image_name, on_progress=progress_cb) + eq(True, d['received_callback']) + def test_rename(tmp_image): rbd = RBD() image_name2 = get_temp_image_name() @@ -1251,6 +1263,16 @@ class TestImage(object): assert(comp.get_return_value() < 0) eq(sys.getrefcount(comp), 2) + # test3: except case + def cbex(_, buf): + raise KeyError() + + def test3(): + comp = self.image.aio_read(IMG_SIZE, 20, cbex) + comp.wait_for_complete_and_cb() + + assert_raises(KeyError, test3) + def test_aio_write(self): retval = [None] def cb(comp): @@ -1449,7 +1471,7 @@ def check_diff(image, offset, length, from_snapshot, expected): extents = [] def cb(offset, length, exists): extents.append((offset, length, exists)) - image.diff_iterate(0, IMG_SIZE, None, cb) + image.diff_iterate(0, IMG_SIZE, from_snapshot, cb) eq(extents, expected) class TestClone(object): |