diff options
author | Jason Dillaman <dillaman@redhat.com> | 2017-12-15 04:17:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-15 04:17:43 +0100 |
commit | 182c25f3e65bcfc602620a20e84b960c6258224a (patch) | |
tree | 32fb4de2bb5942b8f05d62fba86edee0bf81f188 /src/test | |
parent | Merge pull request #19317 from shinobu-x/journaler_trivial_cleanup (diff) | |
parent | pybind/rbd: support open the image by image_id (diff) | |
download | ceph-182c25f3e65bcfc602620a20e84b960c6258224a.tar.xz ceph-182c25f3e65bcfc602620a20e84b960c6258224a.zip |
Merge pull request #19361 from Songweibin/wip-init-image-id
pybind/rbd: support open the image by image_id
Reviewed-by: Jason Dillaman <dillaman@redhat.com>
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/pybind/test_rbd.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/test/pybind/test_rbd.py b/src/test/pybind/test_rbd.py index 43e723c99da..0ee0c8e3c11 100644 --- a/src/test/pybind/test_rbd.py +++ b/src/test/pybind/test_rbd.py @@ -884,6 +884,35 @@ class TestImage(object): # watcher. eq(len(watchers), 1) +class TestImageId(object): + + def setUp(self): + self.rbd = RBD() + create_image() + self.image = Image(ioctx, image_name) + self.image2 = Image(ioctx, None, None, False, self.image.id()) + + def tearDown(self): + self.image.close() + self.image2.close() + remove_image() + self.image = None + self.image2 = None + + def test_read(self): + data = self.image2.read(0, 20) + eq(data, b'\0' * 20) + + def test_write(self): + data = rand_data(256) + self.image2.write(data, 0) + + def test_resize(self): + new_size = IMG_SIZE * 2 + self.image2.resize(new_size) + info = self.image2.stat() + check_stat(info, new_size, IMG_ORDER) + def check_diff(image, offset, length, from_snapshot, expected): extents = [] def cb(offset, length, exists): |