Delete post_test_hook.generate_test_logs
Log files as .txt files, don't zip them, and put them where they need to be instead of copy them there in the post gate hook. The benefit to doing this is that we'll get logs for tests even if the job timed out. Change-Id: I4bfd27534c827aed3cbd7b43d7d1289480ea4806 Related-Bug: #1567668
This commit is contained in:
parent
474b1e7e2f
commit
8adc737cd1
|
@ -502,11 +502,11 @@ tools/configure_for_func_testing.sh is advised (As described above).
|
||||||
When running full-stack tests on a clean VM for the first time, we
|
When running full-stack tests on a clean VM for the first time, we
|
||||||
advise to run ./stack.sh successfully to make sure all Neutron's
|
advise to run ./stack.sh successfully to make sure all Neutron's
|
||||||
dependencies are met. Full-stack based Neutron daemons produce logs to a
|
dependencies are met. Full-stack based Neutron daemons produce logs to a
|
||||||
sub-folder in /tmp/dsvm-fullstack-logs (for example, a test named
|
sub-folder in /opt/stack/logs/dsvm-fullstack-logs (for example, a test named
|
||||||
"test_example" will produce logs to /tmp/dsvm-fullstack-logs/test_example/),
|
"test_example" will produce logs to /opt/stack/logs/dsvm-fullstack-logs/test_example/),
|
||||||
so that will be a good place to look if your test is failing.
|
so that will be a good place to look if your test is failing.
|
||||||
Logging from the test infrastructure itself is placed in:
|
Logging from the test infrastructure itself is placed in:
|
||||||
/tmp/dsvm-fullstack-logs/test_example.log.
|
/opt/stack/logs/dsvm-fullstack-logs/test_example.log.
|
||||||
Fullstack test suite assumes 240.0.0.0/4 (Class E) range in root namespace of
|
Fullstack test suite assumes 240.0.0.0/4 (Class E) range in root namespace of
|
||||||
the test machine is available for its usage.
|
the test machine is available for its usage.
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,10 @@ def find_sample_file(filename):
|
||||||
path=os.path.join(neutron.__path__[0], '..', 'etc'))
|
path=os.path.join(neutron.__path__[0], '..', 'etc'))
|
||||||
|
|
||||||
|
|
||||||
|
def get_test_log_path():
|
||||||
|
return os.environ.get('OS_LOG_PATH', '/tmp')
|
||||||
|
|
||||||
|
|
||||||
class FakePlugin(common_db_mixin.CommonDbMixin,
|
class FakePlugin(common_db_mixin.CommonDbMixin,
|
||||||
agents_db.AgentDbMixin):
|
agents_db.AgentDbMixin):
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -7,19 +7,6 @@ SCRIPTS_DIR="/usr/os-testr-env/bin/"
|
||||||
|
|
||||||
venv=${1:-"dsvm-functional"}
|
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 {
|
function generate_testr_results {
|
||||||
# Give job user rights to access tox logs
|
# Give job user rights to access tox logs
|
||||||
sudo -H -u $owner chmod o+rw .
|
sudo -H -u $owner chmod o+rw .
|
||||||
|
@ -31,18 +18,12 @@ function generate_testr_results {
|
||||||
gzip -9 ./testr_results.html
|
gzip -9 ./testr_results.html
|
||||||
sudo mv ./*.gz /opt/stack/logs/
|
sudo mv ./*.gz /opt/stack/logs/
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$venv" == dsvm-functional* ]] || [[ "$venv" == dsvm-fullstack* ]]
|
|
||||||
then
|
|
||||||
generate_test_logs $log_dir
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ "$venv" == dsvm-functional* ]] || [[ "$venv" == dsvm-fullstack* ]]
|
if [[ "$venv" == dsvm-functional* ]] || [[ "$venv" == dsvm-fullstack* ]]
|
||||||
then
|
then
|
||||||
owner=stack
|
owner=stack
|
||||||
sudo_env=
|
sudo_env=
|
||||||
log_dir="/tmp/${venv}-logs"
|
|
||||||
|
|
||||||
# Set owner permissions according to job's requirements.
|
# Set owner permissions according to job's requirements.
|
||||||
cd $NEUTRON_DIR
|
cd $NEUTRON_DIR
|
||||||
|
|
|
@ -12,18 +12,22 @@
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
from oslo_db.sqlalchemy import test_base
|
from oslo_db.sqlalchemy import test_base
|
||||||
|
|
||||||
from neutron.db.migration import cli as migration
|
from neutron.db.migration import cli as migration
|
||||||
from neutron.tests import base as tests_base
|
from neutron.tests import base as tests_base
|
||||||
from neutron.tests.common import base
|
from neutron.tests.common import base
|
||||||
|
from neutron.tests.common import helpers
|
||||||
from neutron.tests.fullstack.resources import client as client_resource
|
from neutron.tests.fullstack.resources import client as client_resource
|
||||||
from neutron.tests import tools
|
from neutron.tests import tools
|
||||||
|
|
||||||
|
|
||||||
# This is the directory from which infra fetches log files for fullstack tests
|
# This is the directory from which infra fetches log files for fullstack tests
|
||||||
DEFAULT_LOG_DIR = '/tmp/dsvm-fullstack-logs/'
|
DEFAULT_LOG_DIR = os.path.join(helpers.get_test_log_path(),
|
||||||
|
'dsvm-fullstack-logs')
|
||||||
|
|
||||||
|
|
||||||
class BaseFullStackTestCase(base.MySQLTestCase):
|
class BaseFullStackTestCase(base.MySQLTestCase):
|
||||||
|
@ -33,7 +37,7 @@ class BaseFullStackTestCase(base.MySQLTestCase):
|
||||||
super(BaseFullStackTestCase, self).setUp()
|
super(BaseFullStackTestCase, self).setUp()
|
||||||
|
|
||||||
tests_base.setup_test_logging(
|
tests_base.setup_test_logging(
|
||||||
cfg.CONF, DEFAULT_LOG_DIR, '%s.log' % self.get_name())
|
cfg.CONF, DEFAULT_LOG_DIR, '%s.txt' % self.get_name())
|
||||||
|
|
||||||
# NOTE(ihrachys): seed should be reset before environment fixture below
|
# NOTE(ihrachys): seed should be reset before environment fixture below
|
||||||
# since the latter starts services that may rely on generated port
|
# since the latter starts services that may rely on generated port
|
||||||
|
|
|
@ -21,18 +21,20 @@ from neutron.agent.common import config
|
||||||
from neutron.agent.linux import utils
|
from neutron.agent.linux import utils
|
||||||
from neutron.tests import base
|
from neutron.tests import base
|
||||||
from neutron.tests.common import base as common_base
|
from neutron.tests.common import base as common_base
|
||||||
|
from neutron.tests.common import helpers
|
||||||
|
|
||||||
SUDO_CMD = 'sudo -n'
|
SUDO_CMD = 'sudo -n'
|
||||||
|
|
||||||
# This is the directory from which infra fetches log files for functional tests
|
# This is the directory from which infra fetches log files for functional tests
|
||||||
DEFAULT_LOG_DIR = '/tmp/dsvm-functional-logs/'
|
DEFAULT_LOG_DIR = os.path.join(helpers.get_test_log_path(),
|
||||||
|
'dsvm-functional-logs')
|
||||||
|
|
||||||
|
|
||||||
class BaseLoggingTestCase(base.BaseTestCase):
|
class BaseLoggingTestCase(base.BaseTestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(BaseLoggingTestCase, self).setUp()
|
super(BaseLoggingTestCase, self).setUp()
|
||||||
base.setup_test_logging(
|
base.setup_test_logging(
|
||||||
cfg.CONF, DEFAULT_LOG_DIR, "%s.log" % self.id())
|
cfg.CONF, DEFAULT_LOG_DIR, "%s.txt" % self.id())
|
||||||
|
|
||||||
|
|
||||||
class BaseSudoTestCase(BaseLoggingTestCase):
|
class BaseSudoTestCase(BaseLoggingTestCase):
|
||||||
|
|
2
tox.ini
2
tox.ini
|
@ -28,6 +28,7 @@ setenv = OS_SUDO_TESTING=1
|
||||||
OS_ROOTWRAP_CMD=sudo {envdir}/bin/neutron-rootwrap {envdir}/etc/neutron/rootwrap.conf
|
OS_ROOTWRAP_CMD=sudo {envdir}/bin/neutron-rootwrap {envdir}/etc/neutron/rootwrap.conf
|
||||||
OS_ROOTWRAP_DAEMON_CMD=sudo {envdir}/bin/neutron-rootwrap-daemon {envdir}/etc/neutron/rootwrap.conf
|
OS_ROOTWRAP_DAEMON_CMD=sudo {envdir}/bin/neutron-rootwrap-daemon {envdir}/etc/neutron/rootwrap.conf
|
||||||
OS_FAIL_ON_MISSING_DEPS=1
|
OS_FAIL_ON_MISSING_DEPS=1
|
||||||
|
OS_LOG_PATH={env:OS_LOG_PATH:/opt/stack/logs}
|
||||||
commands = false
|
commands = false
|
||||||
|
|
||||||
[testenv:functional]
|
[testenv:functional]
|
||||||
|
@ -35,6 +36,7 @@ basepython = python2.7
|
||||||
setenv = {[testenv]setenv}
|
setenv = {[testenv]setenv}
|
||||||
{[testenv:common]setenv}
|
{[testenv:common]setenv}
|
||||||
OS_TEST_PATH=./neutron/tests/functional
|
OS_TEST_PATH=./neutron/tests/functional
|
||||||
|
OS_LOG_PATH={env:OS_LOG_PATH:/opt/stack/logs}
|
||||||
deps =
|
deps =
|
||||||
{[testenv]deps}
|
{[testenv]deps}
|
||||||
-r{toxinidir}/neutron/tests/functional/requirements.txt
|
-r{toxinidir}/neutron/tests/functional/requirements.txt
|
||||||
|
|
Loading…
Reference in New Issue