From: Mitsuhiro Tanino Date: Fri, 18 Dec 2015 16:02:27 +0000 (-0500) Subject: Override osapi_volume_listen_port for test_workers X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=99bf66b5aebac23892ba4a41595e65f890585e72;p=openstack-build%2Fcinder-build.git Override osapi_volume_listen_port for test_workers After removing WSGI from Cinder, following test cases hit "socket.error: [Errno 98] Address already in use" error. - test_workers_set_default - test_workers_set_good_user_setting - test_workers_set_zero_user_setting The root cause is that these test cases try to use 8776 port, but the port is used by c-api if the service exists. This patch override default port number to avoid the error. Change-Id: I8e2b505c2aff511969cd55851272b10c013aef6c Closes-Bug: #1527566 --- diff --git a/cinder/tests/unit/test_service.py b/cinder/tests/unit/test_service.py index 7dee67b8a..ee8f02099 100644 --- a/cinder/tests/unit/test_service.py +++ b/cinder/tests/unit/test_service.py @@ -278,17 +278,20 @@ class TestWSGIService(test.TestCase): @mock.patch('oslo_service.wsgi.Server') def test_workers_set_default(self, wsgi_server): + self.override_config('osapi_volume_listen_port', 0) test_service = service.WSGIService("osapi_volume") self.assertEqual(processutils.get_worker_count(), test_service.workers) @mock.patch('oslo_service.wsgi.Server') def test_workers_set_good_user_setting(self, wsgi_server): + self.override_config('osapi_volume_listen_port', 0) self.override_config('osapi_volume_workers', 8) test_service = service.WSGIService("osapi_volume") self.assertEqual(8, test_service.workers) @mock.patch('oslo_service.wsgi.Server') def test_workers_set_zero_user_setting(self, wsgi_server): + self.override_config('osapi_volume_listen_port', 0) self.override_config('osapi_volume_workers', 0) test_service = service.WSGIService("osapi_volume") # If a value less than 1 is used, defaults to number of procs available