Browse Source

Add logging for some functional tests

Functional tests log to a file only if they inherit from
the Sudo tests base class. This patch changes the base
class for some test cases to make them log.

Related-Bug: #1567668
Change-Id: I494ad5410e48489f1fb3689cec44c5a29bbc42f3
changes/88/303588/4
Assaf Muller 6 years ago
committed by Jakub Libosvar
parent
commit
474b1e7e2f
  1. 4
      neutron/tests/functional/agent/linux/test_keepalived.py
  2. 12
      neutron/tests/functional/base.py
  3. 4
      neutron/tests/functional/tests/common/exclusive_resources/test_ip_address.py
  4. 4
      neutron/tests/functional/tests/common/exclusive_resources/test_ip_network.py
  5. 4
      neutron/tests/functional/tests/common/exclusive_resources/test_port.py
  6. 4
      neutron/tests/functional/tests/common/exclusive_resources/test_resource_allocator.py

4
neutron/tests/functional/agent/linux/test_keepalived.py

@ -19,12 +19,12 @@ from neutron._i18n import _
from neutron.agent.linux import external_process
from neutron.agent.linux import keepalived
from neutron.agent.linux import utils
from neutron.tests import base
from neutron.tests.functional.agent.linux import helpers
from neutron.tests.functional import base
from neutron.tests.unit.agent.linux import test_keepalived
class KeepalivedManagerTestCase(base.BaseTestCase,
class KeepalivedManagerTestCase(base.BaseLoggingTestCase,
test_keepalived.KeepalivedConfBaseMixin):
def setUp(self):

12
neutron/tests/functional/base.py

@ -28,7 +28,14 @@ SUDO_CMD = 'sudo -n'
DEFAULT_LOG_DIR = '/tmp/dsvm-functional-logs/'
class BaseSudoTestCase(base.BaseTestCase):
class BaseLoggingTestCase(base.BaseTestCase):
def setUp(self):
super(BaseLoggingTestCase, self).setUp()
base.setup_test_logging(
cfg.CONF, DEFAULT_LOG_DIR, "%s.log" % self.id())
class BaseSudoTestCase(BaseLoggingTestCase):
"""
Base class for tests requiring invocation of commands via a root helper.
@ -54,9 +61,6 @@ class BaseSudoTestCase(base.BaseTestCase):
if not base.bool_from_env('OS_SUDO_TESTING'):
self.skipTest('Testing with sudo is not enabled')
base.setup_test_logging(
cfg.CONF, DEFAULT_LOG_DIR, "%s.log" % self.id())
config.register_root_helper(cfg.CONF)
self.config(group='AGENT',
root_helper=os.environ.get('OS_ROOTWRAP_CMD', SUDO_CMD))

4
neutron/tests/functional/tests/common/exclusive_resources/test_ip_address.py

@ -14,11 +14,11 @@
import netaddr
from neutron.tests import base
from neutron.tests.common.exclusive_resources import ip_address
from neutron.tests.functional import base
class TestExclusiveIPAddress(base.DietTestCase):
class TestExclusiveIPAddress(base.BaseLoggingTestCase):
def test_ip_address(self):
address_1 = self.useFixture(
ip_address.ExclusiveIPAddress('10.0.0.1', '10.0.0.2')).address

4
neutron/tests/functional/tests/common/exclusive_resources/test_ip_network.py

@ -14,11 +14,11 @@
import netaddr
from neutron.tests import base
from neutron.tests.common.exclusive_resources import ip_network
from neutron.tests.functional import base
class TestExclusiveIPNetwork(base.DietTestCase):
class TestExclusiveIPNetwork(base.BaseLoggingTestCase):
def test_ip_network(self):
network_1 = self.useFixture(
ip_network.ExclusiveIPNetwork(

4
neutron/tests/functional/tests/common/exclusive_resources/test_port.py

@ -14,11 +14,11 @@
from neutron_lib import constants
from neutron.tests import base
from neutron.tests.common.exclusive_resources import port
from neutron.tests.functional import base
class TestExclusivePort(base.DietTestCase):
class TestExclusivePort(base.BaseLoggingTestCase):
def test_port(self):
port_1 = self.useFixture(port.ExclusivePort(
constants.PROTO_NAME_TCP)).port

4
neutron/tests/functional/tests/common/exclusive_resources/test_resource_allocator.py

@ -17,8 +17,8 @@ import os
import testtools
from neutron.common import utils
from neutron.tests import base
from neutron.tests.common.exclusive_resources import resource_allocator
from neutron.tests.functional import base
def safe_remove_file(file_path):
@ -28,7 +28,7 @@ def safe_remove_file(file_path):
pass
class TestResourceAllocator(base.DietTestCase):
class TestResourceAllocator(base.BaseLoggingTestCase):
def setUp(self):
super(TestResourceAllocator, self).setUp()
self.ra = resource_allocator.ResourceAllocator(

Loading…
Cancel
Save