From: Avishay Traeger Date: Thu, 21 Mar 2013 13:08:04 +0000 (+0200) Subject: Clean up started volume services in tests. X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=d1b37a8471ba5c5d5da315ea39335890b00a52f1;p=openstack-build%2Fcinder-build.git Clean up started volume services in tests. 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 --- diff --git a/cinder/tests/api/contrib/test_admin_actions.py b/cinder/tests/api/contrib/test_admin_actions.py index 8a03466a9..d6ae606f3 100644 --- a/cinder/tests/api/contrib/test_admin_actions.py +++ b/cinder/tests/api/contrib/test_admin_actions.py @@ -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() diff --git a/cinder/tests/test_volume.py b/cinder/tests/test_volume.py index 278e10584..77f7785c1 100644 --- a/cinder/tests/test_volume.py +++ b/cinder/tests/test_volume.py @@ -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'