Discussion:
[Libstoragemgmt-devel] [PATCH 2/2] Plugin test: Fix incorrect NAME_CONFLICT check in test_volume_replication()
Gris Ge
2014-10-14 10:08:21 UTC
Permalink
* If certain plugin didn't raise LsmError on NAME_CONFLICT for
volume_create(), plugin_test.py will incorrectly treat it as PASS.
This patch fixed it by using a error_num variable to checking
NAME_CONFLICT.

Signed-off-by: Gris Ge <***@redhat.com>
---
test/plugin_test.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/test/plugin_test.py b/test/plugin_test.py
index c2b9d3b..a79cc8f 100755
--- a/test/plugin_test.py
+++ b/test/plugin_test.py
@@ -487,14 +487,17 @@ class TestPlugin(unittest.TestCase):
if volume_clone is not None:
# Lets test for creating a clone with an
# existing name
+ error_num = None
try:
volume_clone_dupe_name = \
self.c.volume_replicate(
None, replication_type, vol,
volume_clone.name)[1]
except LsmError as le:
- self.assertTrue(le.code ==
- ErrorNumber.NAME_CONFLICT)
+ error_num = le.code
+
+ self.assertTrue(error_num ==
+ ErrorNumber.NAME_CONFLICT)

self._volume_delete(volume_clone)
--
1.8.3.1
Loading...