]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Clean up started volume services in tests.
authorAvishay Traeger <avishay@il.ibm.com>
Thu, 21 Mar 2013 13:08:04 +0000 (15:08 +0200)
committerAvishay Traeger <avishay@il.ibm.com>
Thu, 21 Mar 2013 13:08:04 +0000 (15:08 +0200)
The test_preattach_status_volume test was failing due to state left by
another test. The interim solution was to skip the aforementioned test.
I tracked down the problem to 4 tests in test_admin_actions.py that
call self.start_service('volume', host='test'), and don't stop the
service. Stopping it in all 4 tests solves the problem.

HOWEVER, I don't know why these started services caused this particular
test to fail. I am still working to figure that out, but maybe someone
has an idea.

Change-Id: I2a5caaae9f61e7c7617c934917a10cf1cf3c0db6
Fixes: bug 1153108
cinder/tests/api/contrib/test_admin_actions.py
cinder/tests/test_volume.py

index 8a03466a987368a4682d06c36d4331d52dafdd70..d6ae606f3020454cbbce0ceb7d1c05df5b4d8cca 100644 (file)
@@ -252,7 +252,7 @@ class AdminActionsTest(test.TestCase):
         # attach admin context to request
         req.environ['cinder.context'] = ctx
         # start service to handle rpc.cast for 'delete snapshot'
-        self.start_service('volume', host='test')
+        svc = self.start_service('volume', host='test')
         # make request
         resp = req.get_response(app())
         # request is accepted
@@ -260,6 +260,8 @@ class AdminActionsTest(test.TestCase):
         # snapshot is deleted
         self.assertRaises(exception.NotFound, db.snapshot_get, ctx,
                           snapshot['id'])
+        # cleanup
+        svc.stop()
 
     def test_force_detach_volume(self):
         # admin context
@@ -268,7 +270,7 @@ class AdminActionsTest(test.TestCase):
         volume = db.volume_create(ctx, {'status': 'available', 'host': 'test',
                                         'provider_location': ''})
         # start service to handle rpc messages for attach requests
-        self.start_service('volume', host='test')
+        svc = self.start_service('volume', host='test')
         self.volume_api.reserve_volume(ctx, volume)
         self.volume_api.initialize_connection(ctx, volume, {})
         mountpoint = '/dev/vbd'
@@ -297,6 +299,8 @@ class AdminActionsTest(test.TestCase):
         self.assertEquals(volume['instance_uuid'], None)
         self.assertEquals(volume['mountpoint'], None)
         self.assertEquals(volume['attach_status'], 'detached')
+        # cleanup
+        svc.stop()
 
     def test_attach_in_use_volume(self):
         """Test that attaching to an in-use volume fails."""
@@ -306,7 +310,7 @@ class AdminActionsTest(test.TestCase):
         volume = db.volume_create(ctx, {'status': 'available', 'host': 'test',
                                         'provider_location': ''})
         # start service to handle rpc messages for attach requests
-        self.start_service('volume', host='test')
+        svc = self.start_service('volume', host='test')
         self.volume_api.reserve_volume(ctx, volume)
         self.volume_api.initialize_connection(ctx, volume, {})
         mountpoint = '/dev/vbd'
@@ -317,6 +321,8 @@ class AdminActionsTest(test.TestCase):
                           volume,
                           fakes.get_fake_uuid(),
                           mountpoint)
+        # cleanup
+        svc.stop()
 
     def test_attach_attaching_volume_with_different_instance(self):
         """Test that attaching volume reserved for another instance fails."""
@@ -326,7 +332,7 @@ class AdminActionsTest(test.TestCase):
         volume = db.volume_create(ctx, {'status': 'available', 'host': 'test',
                                         'provider_location': ''})
         # start service to handle rpc messages for attach requests
-        self.start_service('volume', host='test')
+        svc = self.start_service('volume', host='test')
         self.volume_api.initialize_connection(ctx, volume, {})
         values = {'status': 'attaching',
                   'instance_uuid': fakes.get_fake_uuid()}
@@ -338,3 +344,5 @@ class AdminActionsTest(test.TestCase):
                           volume,
                           stubs.FAKE_UUID,
                           mountpoint)
+        # cleanup
+        svc.stop()
index 278e10584f76c2d51ccb1951167d7086b4d9bb6a..77f7785c15c357452fd3c7986c2924a2aa709ceb 100644 (file)
@@ -293,7 +293,6 @@ class VolumeTestCase(test.TestCase):
                           self.context,
                           volume_id)
 
-    @test.skip_test
     def test_preattach_status_volume(self):
         """Ensure volume goes into pre-attaching state"""
         instance_uuid = '12345678-1234-5678-1234-567812345678'