Change "cmd" folder in fullstack tests

When fullstack tests are executed manually using a debugger
(e.g.: PyCharm integrated debugger), the "cmd" folder is imported
instead of "cmd" [1] module.

To solve this problem, this folder and the references to this path
must be changed.

[1] https://docs.python.org/3/library/cmd.html

Change-Id: I8e6b6995c10875a882a46ca3a0d779aafda124a3
Closes-Bug: #1805844
This commit is contained in:
Rodolfo Alonso Hernandez 2018-11-29 13:55:21 +00:00
parent dd14501c12
commit b617df2b21
8 changed files with 8 additions and 7 deletions

View File

@ -33,6 +33,7 @@ from neutron.tests.common import net_helpers
from neutron.tests.fullstack import base as fullstack_base
LOG = logging.getLogger(__name__)
CMD_FOLDER = 'agents'
class ProcessFixture(fixtures.Fixture):
@ -207,7 +208,7 @@ class OVSAgentFixture(ServiceFixture):
process_name=self.NEUTRON_OVS_AGENT,
exec_name=spawn.find_executable(
'ovs_agent.py',
path=os.path.join(fullstack_base.ROOTDIR, 'cmd')),
path=os.path.join(fullstack_base.ROOTDIR, CMD_FOLDER)),
config_filenames=config_filenames,
kill_signal=signal.SIGTERM))
@ -298,7 +299,7 @@ class L3AgentFixture(ServiceFixture):
else:
exec_name = spawn.find_executable(
'l3_agent.py',
path=os.path.join(fullstack_base.ROOTDIR, 'cmd'))
path=os.path.join(fullstack_base.ROOTDIR, CMD_FOLDER))
self.process_fixture = self.useFixture(
ProcessFixture(
@ -341,7 +342,7 @@ class DhcpAgentFixture(fixtures.Fixture):
else:
exec_name = spawn.find_executable(
'dhcp_agent.py',
path=os.path.join(fullstack_base.ROOTDIR, 'cmd'))
path=os.path.join(fullstack_base.ROOTDIR, CMD_FOLDER))
self.process_fixture = self.useFixture(
ProcessFixture(

View File

@ -19,8 +19,8 @@ from oslo_utils import uuidutils
from neutron.agent.linux import ip_lib
from neutron.common import utils as common_utils
from neutron.tests.fullstack.agents import dhcp_agent
from neutron.tests.fullstack import base
from neutron.tests.fullstack.cmd import dhcp_agent as cmd
from neutron.tests.fullstack.resources import environment
from neutron.tests.fullstack.resources import machine
from neutron.tests.unit import testlib_api
@ -104,7 +104,7 @@ class TestDhcpAgentNoHA(BaseDhcpAgentTest):
self.vm.block_until_dhcp_config_done()
namespace = cmd._get_namespace_name(
namespace = dhcp_agent._get_namespace_name(
self.network['id'],
suffix=self.environment.hosts[0].dhcp_agent.get_namespace_suffix())
ip = ip_lib.IPWrapper(namespace)

View File

@ -202,7 +202,7 @@ function _install_rootwrap_sudoers {
SECURE_PATH="$PROJECT_VENV/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
if [[ "$VENV" =~ "dsvm-fullstack" ]]; then
SECURE_PATH="$REPO_BASE/$PROJECT_NAME/neutron/tests/fullstack/cmd:$SECURE_PATH"
SECURE_PATH="$REPO_BASE/$PROJECT_NAME/neutron/tests/fullstack/agents:$SECURE_PATH"
fi
cat << EOF > $TEMPFILE

View File

@ -32,7 +32,7 @@ neutron_path=$1
target_etc_path=$2
target_bin_path=$3
fullstack_path=$neutron_path/neutron/tests/fullstack/cmd
fullstack_path=$neutron_path/neutron/tests/fullstack/agents
src_conf_path=${neutron_path}/etc
src_conf=${src_conf_path}/rootwrap.conf