]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
NetApp: Fix failing NetApp tests
authorRushi Agrawal <rushi.agr@gmail.com>
Thu, 11 Apr 2013 14:01:37 +0000 (19:31 +0530)
committerRushi Agrawal <rushi.agr@gmail.com>
Sun, 14 Apr 2013 17:31:36 +0000 (23:01 +0530)
The tests were failing due to an upgrade in the testing framework
(possibly due to upgrade of nose package from 1.2.1 to 1.3.0).
The actual reason was a bug in the suds client. A simple
workaround is utilised here, which sets the logging level of a
suds file to INFO instead of DEBUG.

Some 'FutureWarning' warnings from the test output were also
fixed.

Change-Id: Ia67476c23bffa91264cf79f6a26944b450c4f4fc

cinder/tests/test_netapp.py

index c192ee2ded07485b8f119f3be003d0c09aacd1a2..c5e5738814e1d67e6365cdf2035b540302214b42 100644 (file)
@@ -21,6 +21,7 @@ Tests for NetApp volume driver
 
 import BaseHTTPServer
 import httplib
+import logging as generic_logging
 import shutil
 import StringIO
 import tempfile
@@ -37,6 +38,14 @@ from cinder.volume.drivers.netapp.iscsi import netapp_opts
 
 LOG = logging.getLogger("cinder.volume.driver")
 
+#NOTE(rushiagr): A bug in Suds package
+#           (https://fedorahosted.org/suds/ticket/359) causes nasty errors
+#           with tests while using debug-level logging. Unfortunately,
+#           the maintainers of the package stopped tending to any patch
+#           requests almost two years back. So setting the logging level to
+#           INFO here seems the only plausible workaround.
+generic_logging.getLogger('suds.mx.core').setLevel(generic_logging.INFO)
+
 WSDL_HEADER = """<?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <definitions xmlns="http://schemas.xmlsoap.org/wsdl/"
     xmlns:na="http://www.netapp.com/management/v1"
@@ -1008,11 +1017,9 @@ class NetAppDriverTestCase(test.TestCase):
         shutil.rmtree(self.tempdir)
         super(NetAppDriverTestCase, self).tearDown()
 
-    @test.skip_test("Failing due to suds error - skip until fixed")
     def test_connect(self):
         self.driver.check_for_setup_error()
 
-    @test.skip_test("Failing due to suds error - skip until fixed")
     def test_create_destroy(self):
         self.driver._discover_luns()
         self.driver._provision(self.VOLUME_NAME, None, self.PROJECT_ID,
@@ -1022,7 +1029,6 @@ class NetAppDriverTestCase(test.TestCase):
     def test_destroy_uncreated_volume(self):
         self.driver._remove_destroy('fake-nonexistent-volume', self.PROJECT_ID)
 
-    @test.skip_test("Failing due to suds error - skip until fixed")
     def test_map_unmap(self):
         self.driver._discover_luns()
         self.driver._provision(self.VOLUME_NAME, None, self.PROJECT_ID,
@@ -1039,13 +1045,11 @@ class NetAppDriverTestCase(test.TestCase):
         self.driver.terminate_connection(volume, connector)
         self.driver._remove_destroy(self.VOLUME_NAME, self.PROJECT_ID)
 
-    @test.skip_test("Failing due to suds error - skip until fixed")
     def test_clone(self):
         self.driver._discover_luns()
         self.driver._clone_lun(0, '/vol/vol/qtree/src', '/vol/vol/qtree/dst',
                                False)
 
-    @test.skip_test("Failing due to suds error - skip until fixed")
     def test_clone_fail(self):
         self.driver._discover_luns()
         self.driver._is_clone_done(0, '0', 'xxx')
@@ -1431,16 +1435,13 @@ class NetAppCmodeISCSIDriverTestCase(test.TestCase):
                               hostname='localhost', port=8080, cache=False)
         self.driver = driver
 
-    @test.skip_test("Failing due to suds error - skip until fixed")
     def test_connect(self):
         self.driver.check_for_setup_error()
 
-    @test.skip_test("Failing due to suds error - skip until fixed")
     def test_create_destroy(self):
         self.driver.create_volume(self.volume)
         self.driver.delete_volume(self.volume)
 
-    @test.skip_test("Failing due to suds error - skip until fixed")
     def test_create_vol_snapshot_destroy(self):
         self.driver.create_volume(self.volume)
         self.driver.create_snapshot(self.snapshot)
@@ -1448,7 +1449,6 @@ class NetAppCmodeISCSIDriverTestCase(test.TestCase):
         self.driver.delete_snapshot(self.snapshot)
         self.driver.delete_volume(self.volume)
 
-    @test.skip_test("Failing due to suds error - skip until fixed")
     def test_map_unmap(self):
         self.driver.create_volume(self.volume)
         updates = self.driver.create_export(None, self.volume)
@@ -1464,7 +1464,6 @@ class NetAppCmodeISCSIDriverTestCase(test.TestCase):
         self.driver.terminate_connection(self.volume, self.connector)
         self.driver.delete_volume(self.volume)
 
-    @test.skip_test("Failing due to suds error - skip until fixed")
     def test_fail_vol_from_snapshot_creation(self):
         self.driver.create_volume(self.volume)
         try:
@@ -1476,14 +1475,12 @@ class NetAppCmodeISCSIDriverTestCase(test.TestCase):
         finally:
             self.driver.delete_volume(self.volume)
 
-    @test.skip_test("Failing due to suds error - skip until fixed")
     def test_cloned_volume_destroy(self):
         self.driver.create_volume(self.volume)
         self.driver.create_cloned_volume(self.snapshot, self.volume)
         self.driver.delete_volume(self.snapshot)
         self.driver.delete_volume(self.volume)
 
-    @test.skip_test("Failing due to suds error - skip until fixed")
     def test_fail_cloned_volume_creation(self):
         self.driver.create_volume(self.volume)
         try:
@@ -1660,13 +1657,13 @@ class FakeDirectCMODEServerHandler(FakeHTTPRequestHandler):
             init_found = True
             query = FakeDirectCMODEServerHandler._get_child_by_name(request,
                                                                     'query')
-            if query:
+            if query is not None:
                 igroup_info = FakeDirectCMODEServerHandler._get_child_by_name(
                     query, 'initiator-group-info')
-                if igroup_info:
+                if igroup_info is not None:
                     inits = FakeDirectCMODEServerHandler._get_child_by_name(
                         igroup_info, 'initiators')
-                    if inits:
+                    if inits is not None:
                         init_info = \
                             FakeDirectCMODEServerHandler._get_child_by_name(
                                 inits, 'initiator-info')