From b617df2b2158fb3668795d8db9e112b27d083623 Mon Sep 17 00:00:00 2001 From: Rodolfo Alonso Hernandez Date: Thu, 29 Nov 2018 13:55:21 +0000 Subject: [PATCH] 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 --- neutron/tests/fullstack/{cmd => agents}/__init__.py | 0 neutron/tests/fullstack/{cmd => agents}/dhcp_agent.py | 0 neutron/tests/fullstack/{cmd => agents}/l3_agent.py | 0 neutron/tests/fullstack/{cmd => agents}/ovs_agent.py | 0 neutron/tests/fullstack/resources/process.py | 7 ++++--- neutron/tests/fullstack/test_dhcp_agent.py | 4 ++-- tools/configure_for_func_testing.sh | 2 +- tools/deploy_rootwrap.sh | 2 +- 8 files changed, 8 insertions(+), 7 deletions(-) rename neutron/tests/fullstack/{cmd => agents}/__init__.py (100%) rename neutron/tests/fullstack/{cmd => agents}/dhcp_agent.py (100%) rename neutron/tests/fullstack/{cmd => agents}/l3_agent.py (100%) rename neutron/tests/fullstack/{cmd => agents}/ovs_agent.py (100%) diff --git a/neutron/tests/fullstack/cmd/__init__.py b/neutron/tests/fullstack/agents/__init__.py similarity index 100% rename from neutron/tests/fullstack/cmd/__init__.py rename to neutron/tests/fullstack/agents/__init__.py diff --git a/neutron/tests/fullstack/cmd/dhcp_agent.py b/neutron/tests/fullstack/agents/dhcp_agent.py similarity index 100% rename from neutron/tests/fullstack/cmd/dhcp_agent.py rename to neutron/tests/fullstack/agents/dhcp_agent.py diff --git a/neutron/tests/fullstack/cmd/l3_agent.py b/neutron/tests/fullstack/agents/l3_agent.py similarity index 100% rename from neutron/tests/fullstack/cmd/l3_agent.py rename to neutron/tests/fullstack/agents/l3_agent.py diff --git a/neutron/tests/fullstack/cmd/ovs_agent.py b/neutron/tests/fullstack/agents/ovs_agent.py similarity index 100% rename from neutron/tests/fullstack/cmd/ovs_agent.py rename to neutron/tests/fullstack/agents/ovs_agent.py diff --git a/neutron/tests/fullstack/resources/process.py b/neutron/tests/fullstack/resources/process.py index 7568cb61c2c..1d6bc3e7d9b 100644 --- a/neutron/tests/fullstack/resources/process.py +++ b/neutron/tests/fullstack/resources/process.py @@ -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( diff --git a/neutron/tests/fullstack/test_dhcp_agent.py b/neutron/tests/fullstack/test_dhcp_agent.py index d93acf114dd..c4e5d8a9a9b 100644 --- a/neutron/tests/fullstack/test_dhcp_agent.py +++ b/neutron/tests/fullstack/test_dhcp_agent.py @@ -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) diff --git a/tools/configure_for_func_testing.sh b/tools/configure_for_func_testing.sh index e8324e8e679..89c62e9bbcc 100755 --- a/tools/configure_for_func_testing.sh +++ b/tools/configure_for_func_testing.sh @@ -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 diff --git a/tools/deploy_rootwrap.sh b/tools/deploy_rootwrap.sh index d1b1feec2ca..ec392ae825b 100755 --- a/tools/deploy_rootwrap.sh +++ b/tools/deploy_rootwrap.sh @@ -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