This helps greatly the debugging process in face of race conditions.
Change-Id: I74235307183cbb15a7179b18b417b38ffb1d2cc9
return int(os.environ.get('OS_TEST_TIMEOUT', 0))
+def sanitize_log_path(path):
+ # Sanitize the string so that it's log path is shell friendly
+ return path.replace(' ', '-').replace('(', '_').replace(')', '_')
+
+
class AttributeDict(dict):
"""
venv=${1:-"dsvm-functional"}
+function generate_test_logs {
+ local path="$1"
+ # Compress all $path/*.txt files and move the directories holding those
+ # files to /opt/stack/logs. Files with .log suffix have their
+ # suffix changed to .txt (so browsers will know to open the compressed
+ # files and not download them).
+ if [ -d "$path" ]
+ then
+ sudo find $path -iname "*.log" -type f -exec mv {} {}.txt \; -exec gzip -9 {}.txt \;
+ sudo mv $path/* /opt/stack/logs/
+ fi
+}
+
function generate_testr_results {
# Give job user rights to access tox logs
sudo -H -u $owner chmod o+rw .
sudo mv ./*.gz /opt/stack/logs/
fi
- # Compress all /tmp/fullstack-*/*.txt files and move the directories
- # holding those files to /opt/stack/logs. Files with .log suffix have their
- # suffix changed to .txt (so browsers will know to open the compressed
- # files and not download them).
- if [ "$venv" == "dsvm-fullstack" ] && [ -d /tmp/fullstack-logs/ ]; then
- sudo find /tmp/fullstack-logs -iname "*.log" -type f -exec mv {} {}.txt \; -exec gzip -9 {}.txt \;
- sudo mv /tmp/fullstack-logs/* /opt/stack/logs/
+ if [ "$venv" == "dsvm-functional" ] || [ "$venv" == "dsvm-fullstack" ]
+ then
+ generate_test_logs "/tmp/${venv}-logs"
fi
}
LOG = logging.getLogger(__name__)
-# This should correspond the directory from which infra retrieves log files
-DEFAULT_LOG_DIR = '/tmp/fullstack-logs/'
+# This is the directory from which infra fetches log files for fullstack tests
+DEFAULT_LOG_DIR = '/tmp/dsvm-fullstack-logs/'
class ProcessFixture(fixtures.Fixture):
self._configure()
def _configure(self):
- config.setup_logging()
config.register_interface_driver_opts_helper(cfg.CONF)
cfg.CONF.set_override(
'interface_driver',
def _configure_agent(self, host):
conf = self._get_config_opts()
l3_agent_main.register_opts(conf)
- cfg.CONF.set_override('debug', False)
- agent_config.setup_logging()
conf.set_override(
'interface_driver',
'neutron.agent.linux.interface.OVSInterfaceDriver')
from neutron.agent.common import config
from neutron.agent.linux import utils
+from neutron.common import utils as common_utils
from neutron.tests import base
from neutron.tests.common import base as common_base
SUDO_CMD = 'sudo -n'
+# This is the directory from which infra fetches log files for functional tests
+DEFAULT_LOG_DIR = '/tmp/dsvm-functional-logs/'
+
class BaseSudoTestCase(base.BaseTestCase):
"""
def setUp(self):
super(BaseSudoTestCase, self).setUp()
-
if not base.bool_from_env('OS_SUDO_TESTING'):
self.skipTest('Testing with sudo is not enabled')
+ # Have each test log into its own log file
+ cfg.CONF.set_override('debug', True)
+ common_utils.ensure_dir(DEFAULT_LOG_DIR)
+ log_file = base.sanitize_log_path(
+ os.path.join(DEFAULT_LOG_DIR, "%s.log" % self.id()))
+ cfg.CONF.set_override('log_file', log_file)
+ config.setup_logging()
+
config.register_root_helper(cfg.CONF)
self.config(group='AGENT',
root_helper=os.environ.get('OS_ROOTWRAP_CMD', SUDO_CMD))