blob: 40a0f5f92ee6a10a3291aa3122a6d50b925d9dea [file] [log] [blame]
Peter Pentchevea354462023-07-18 11:15:56 +03001From 769fa5b7ec1e333544f5b8e454225757db73fb87 Mon Sep 17 00:00:00 2001
Peter Pentchevfad59c62023-01-17 08:44:27 +02002From: Peter Penchev <openstack-dev@storpool.com>
3Date: Tue, 17 Jan 2023 01:20:59 +0200
Peter Pentchevacaaa382023-02-28 11:26:13 +02004Subject: [PATCH 07/10] StorPool: fix the "rename volume" unit test emulation
Peter Pentchev844a5d92023-01-17 03:07:56 +02005
6Also update the "name" field of the actual data structure in
7the fake list of volumes.
8
9Change-Id: Iee9e3feea1af4f3d0acdf05ea1b540ecf59e755b
Peter Pentchevfad59c62023-01-17 08:44:27 +020010---
11 cinder/tests/unit/volume/drivers/test_storpool.py | 7 ++++++-
12 1 file changed, 6 insertions(+), 1 deletion(-)
13
14diff --git a/cinder/tests/unit/volume/drivers/test_storpool.py b/cinder/tests/unit/volume/drivers/test_storpool.py
15index 2e6f56526..f878c6d26 100644
Peter Pentchev844a5d92023-01-17 03:07:56 +020016--- a/cinder/tests/unit/volume/drivers/test_storpool.py
17+++ b/cinder/tests/unit/volume/drivers/test_storpool.py
Peter Pentchevfad59c62023-01-17 08:44:27 +020018@@ -135,7 +135,10 @@ class MockAPI(object):
Peter Pentchev844a5d92023-01-17 03:07:56 +020019 volumes[name]['size'] = data['size']
20
21 if 'rename' in data and data['rename'] != name:
22- volumes[data['rename']] = volumes[name]
23+ new_name = data['rename']
24+ volumes[new_name] = volumes[name]
25+ if volumes[new_name]['name'] == name:
26+ volumes[new_name]['name'] = new_name
27 del volumes[name]
28
29
Peter Pentchevfad59c62023-01-17 08:44:27 +020030@@ -259,6 +262,8 @@ class StorPoolTestCase(test.TestCase):
Peter Pentchev844a5d92023-01-17 03:07:56 +020031 def assertVolumeNames(self, names):
32 self.assertListEqual(sorted([volumeName(n) for n in names]),
33 sorted(volumes.keys()))
34+ self.assertListEqual(sorted([volumeName(n) for n in names]),
35+ sorted(data['name'] for data in volumes.values()))
36
37 @mock_volume_types
38 def test_create_delete_volume(self):
Peter Pentchevfad59c62023-01-17 08:44:27 +020039--
Peter Pentchevea354462023-07-18 11:15:56 +0300402.40.1
Peter Pentchevfad59c62023-01-17 08:44:27 +020041