diff options
22 files changed, 45 insertions, 182 deletions
diff --git a/docker/Dockerfile b/docker/Dockerfile index d38713e06..b4bff0e16 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -25,14 +25,13 @@ ARG FUNCTEST_CONF_DIR=${FUNCTEST_BASE_DIR}/conf ARG FUNCTEST_DATA_DIR=${FUNCTEST_BASE_DIR}/data ARG FUNCTEST_IMAGES_DIR=${FUNCTEST_BASE_DIR}/images ARG FUNCTEST_RESULTS_DIR=${FUNCTEST_BASE_DIR}/results -ARG FUNCTEST_REPO_DIR=${REPOS_DIR}/functest -ARG FUNCTEST_TEST_DIR=${FUNCTEST_REPO_DIR}/functest/opnfv_tests +ARG FUNCTEST_DIR=/usr/local/lib/python2.7/dist-packages/functest/ ARG REPOS_VNFS_DIR=${REPOS_DIR}/vnfs -ARG PIP_OPTS=-chttps://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?stable/ocata +ARG PIP_OPTS=-chttps://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=stable/ocata # Environment variables ENV HOME /home/opnfv -ENV CONFIG_FUNCTEST_YAML ${FUNCTEST_REPO_DIR}/functest/ci/config_functest.yaml +ENV CONFIG_FUNCTEST_YAML ${FUNCTEST_DIR}/ci/config_functest.yaml ENV REPOS_DIR ${HOME}/repos ENV creds ${FUNCTEST_CONF_DIR}/openstack.creds @@ -65,8 +64,7 @@ wget \ RUN pip install --upgrade pip && easy_install -U setuptools==30.0.0 -RUN mkdir -p ${FUNCTEST_REPO_DIR} \ - && mkdir -p ${REPOS_VNFS_DIR} \ +RUN mkdir -p ${REPOS_VNFS_DIR} \ && mkdir -p ${FUNCTEST_BASE_DIR}/results \ && mkdir -p ${FUNCTEST_CONF_DIR} \ && mkdir -p ${FUNCTEST_DATA_DIR} \ @@ -84,9 +82,6 @@ RUN pip install ${PIP_OPTS} \ -r thirdparty-requirements.txt \ && rm thirdparty-requirements.txt -# Hook required by hardcoded paths in Functest -RUN ln -s /usr/local/lib/python2.7/dist-packages/functest ${FUNCTEST_REPO_DIR}/functest - # OPNFV repositories RUN git clone --depth 1 -b $BRANCH https://gerrit.opnfv.org/gerrit/copper ${REPOS_DIR}/copper RUN git clone --depth 1 -b $BRANCH https://gerrit.opnfv.org/gerrit/domino ${REPOS_DIR}/domino @@ -101,22 +96,6 @@ RUN git clone --depth 1 -b $VIMS_TAG https://github.com/boucherv-orange/clearwat RUN git clone --depth 1 -b $VROUTER_TAG https://github.com/oolorg/opnfv-functest-vrouter.git ${REPOS_VNFS_DIR}/vrouter RUN git clone --depth 1 https://github.com/wuwenbin2/OnosSystemTest.git ${REPOS_DIR}/onos -RUN find -L ${FUNCTEST_REPO_DIR} -name "*.py" \ - -not -path "*tests/unit*" \ - -not -path "*functest_venv*" \ - |xargs grep -L __main__ |cut -d\: -f 1 |xargs chmod -c 644 \ - && find -L ${FUNCTEST_REPO_DIR} -name "*.sh" \ - -not -path "*functest_venv*" \ - |xargs grep -L \#\! |cut -d\: -f 1 |xargs chmod -c 644 - -RUN find -L ${FUNCTEST_REPO_DIR} -name "*.py" \ - -not -path "*tests/unit*" \ - -not -path "*functest_venv*" \ - |xargs grep __main__ |cut -d\: -f 1 |xargs chmod -c 755 \ - && find -L ${FUNCTEST_REPO_DIR} -name "*.sh" \ - -not -path "*functest_venv*" \ - |xargs grep \#\! |cut -d\: -f 1 |xargs chmod -c 755 - RUN wget -q https://git.openstack.org/cgit/openstack/rally/plain/install_rally.sh?h=${RALLY_TAG} -O install_rally.sh \ && bash install_rally.sh --branch ${RALLY_TAG} --yes && rm install_rally.sh @@ -151,4 +130,4 @@ RUN sh -c 'curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -' \ && cd ${REPOS_DIR}/promise && sudo npm -g install npm@latest \ && cd ${REPOS_DIR}/promise/source && npm install -RUN echo ". ${FUNCTEST_REPO_DIR}/functest/cli/functest-complete.sh" >> ${HOME}/.bashrc +RUN echo ". ${FUNCTEST_DIR}/cli/functest-complete.sh" >> ${HOME}/.bashrc diff --git a/docker/Dockerfile.aarch64 b/docker/Dockerfile.aarch64 index 77c94b02f..6f17d1a62 100644 --- a/docker/Dockerfile.aarch64 +++ b/docker/Dockerfile.aarch64 @@ -24,14 +24,13 @@ ARG FUNCTEST_CONF_DIR=${FUNCTEST_BASE_DIR}/conf ARG FUNCTEST_DATA_DIR=${FUNCTEST_BASE_DIR}/data ARG FUNCTEST_IMAGES_DIR=${FUNCTEST_BASE_DIR}/images ARG FUNCTEST_RESULTS_DIR=${FUNCTEST_BASE_DIR}/results -ARG FUNCTEST_REPO_DIR=${REPOS_DIR}/functest -ARG FUNCTEST_TEST_DIR=${FUNCTEST_REPO_DIR}/functest/opnfv_tests +ARG FUNCTEST_DIR=/usr/local/lib/python2.7/dist-packages/functest/ ARG REPOS_VNFS_DIR=${REPOS_DIR}/vnfs -ARG PIP_OPTS=-chttps://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?stable/ocata +ARG PIP_OPTS=-chttps://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=stable/ocata # Environment variables ENV HOME /home/opnfv -ENV CONFIG_FUNCTEST_YAML ${FUNCTEST_REPO_DIR}/functest/ci/config_functest.yaml +ENV CONFIG_FUNCTEST_YAML ${FUNCTEST_DIR}/functest/ci/config_functest.yaml ENV REPOS_DIR ${HOME}/repos ENV creds ${FUNCTEST_CONF_DIR}/openstack.creds @@ -64,8 +63,7 @@ wget \ RUN pip install --upgrade pip && easy_install -U setuptools==30.0.0 -RUN mkdir -p ${FUNCTEST_REPO_DIR} \ - && mkdir -p ${REPOS_VNFS_DIR} \ +RUN mkdir -p ${REPOS_VNFS_DIR} \ && mkdir -p ${FUNCTEST_BASE_DIR}/results \ && mkdir -p ${FUNCTEST_BASE_DIR}/conf \ && mkdir -p ${FUNCTEST_DATA_DIR} \ @@ -93,22 +91,6 @@ RUN git clone --depth 1 -b $ODL_TAG https://git.opendaylight.org/gerrit/p/integr RUN git clone --depth 1 -b $VIMS_TAG https://github.com/boucherv-orange/clearwater-live-test ${REPOS_VNFS_DIR}/vims-test RUN git clone --depth 1 https://github.com/wuwenbin2/OnosSystemTest.git ${REPOS_DIR}/onos -RUN find -L ${FUNCTEST_REPO_DIR} -name "*.py" \ - -not -path "*tests/unit*" \ - -not -path "*functest_venv*" \ - |xargs grep -L __main__ |cut -d\: -f 1 |xargs chmod -c 644 \ - && find -L ${FUNCTEST_REPO_DIR} -name "*.sh" \ - -not -path "*functest_venv*" \ - |xargs grep -L \#\! |cut -d\: -f 1 |xargs chmod -c 644 - -RUN find -L ${FUNCTEST_REPO_DIR} -name "*.py" \ - -not -path "*tests/unit*" \ - -not -path "*functest_venv*" \ - |xargs grep __main__ |cut -d\: -f 1 |xargs chmod -c 755 \ - && find -L ${FUNCTEST_REPO_DIR} -name "*.sh" \ - -not -path "*functest_venv*" \ - |xargs grep \#\! |cut -d\: -f 1 |xargs chmod -c 755 - RUN wget -q https://git.openstack.org/cgit/openstack/rally/plain/install_rally.sh?h=${RALLY_TAG} -O install_rally.sh \ && bash install_rally.sh --branch ${RALLY_TAG} --yes && rm install_rally.sh @@ -145,4 +127,4 @@ RUN sh -c 'wget -qO- https://nodejs.org/dist/v4.7.2/node-v4.7.2-linux-arm64.tar. && cd ${REPOS_DIR}/promise && sudo npm -g install npm@latest \ && cd ${REPOS_DIR}/promise/source && npm install -RUN echo ". ${FUNCTEST_REPO_DIR}/functest/cli/functest-complete.sh" >> ${HOME}/.bashrc +RUN echo ". ${FUNCTEST_DIR}/cli/functest-complete.sh" >> ${HOME}/.bashrc diff --git a/docker/add_images.sh b/docker/add_images.sh index 919cecd8f..1e5382c20 100755..100644 --- a/docker/add_images.sh +++ b/docker/add_images.sh @@ -2,13 +2,15 @@ # # This script downloads the images that are used for testing # and places them in the functest docker image +set -e -CIRROS_REPO_URL=http://download.cirros-cloud.net +CIRROS_REPO_URL=https://download.cirros-cloud.net CIRROS_AARCH64_TAG=161201 CIRROS_X86_64_TAG=0.3.5 wget ${CIRROS_REPO_URL}/${CIRROS_X86_64_TAG}/cirros-${CIRROS_X86_64_TAG}-x86_64-disk.img -P ${FUNCTEST_IMAGES_DIR} wget ${CIRROS_REPO_URL}/${CIRROS_X86_64_TAG}/cirros-${CIRROS_X86_64_TAG}-x86_64-lxc.tar.gz -P ${FUNCTEST_IMAGES_DIR} +wget http://artifacts.opnfv.org/onosfw/images/firewall_block_image.img -P ${FUNCTEST_IMAGES_DIR} # Add the 3-part image for aarch64, since functest can be run from an x86 machine to test an aarch64 POD wget ${CIRROS_REPO_URL}/daily/20${CIRROS_AARCH64_TAG}/cirros-d${CIRROS_AARCH64_TAG}-aarch64-disk.img -P ${FUNCTEST_IMAGES_DIR} diff --git a/docker/config_install_env.sh b/docker/config_install_env.sh index ed67994f0..ed67994f0 100755..100644 --- a/docker/config_install_env.sh +++ b/docker/config_install_env.sh diff --git a/docker/docker_remote_api/enable_remote_api.sh b/docker/docker_remote_api/enable_remote_api.sh index 76e59b850..76e59b850 100755..100644 --- a/docker/docker_remote_api/enable_remote_api.sh +++ b/docker/docker_remote_api/enable_remote_api.sh diff --git a/docker/thirdparty-requirements.txt b/docker/thirdparty-requirements.txt index d1c3a917f..cd56a0681 100644 --- a/docker/thirdparty-requirements.txt +++ b/docker/thirdparty-requirements.txt @@ -6,5 +6,5 @@ git+https://gerrit.opnfv.org/gerrit/sfc#egg=sfc tosca-parser>=0.7.0 # Apache-2.0 heat-translator>=0.4.0 # Apache-2.0 rally -tempest>=15.0.0 # Apache-2.0 -git+https://github.com/openstack/refstack-client#egg=refstack-client
\ No newline at end of file +tempest>=12.1.0 # Apache-2.0 +git+https://github.com/openstack/refstack-client#egg=refstack-client diff --git a/docs/testing/user/configguide/configguide.rst b/docs/testing/user/configguide/configguide.rst index 083bbf3a8..5c89cf0e6 100644 --- a/docs/testing/user/configguide/configguide.rst +++ b/docs/testing/user/configguide/configguide.rst @@ -327,9 +327,7 @@ includes two main directories: the **data** directory stores a 'cirros' test image used in some functional tests and the **results** directory stores some temporary result log files - * The **repos** directory holds various repositories. The directory - '/home/opnfv/repos/functest' is used to prepare the needed Functest - environment and to run the tests. The other repository directories + * The **repos** directory holds various repositories. The directories are used for the installation of the needed tooling (e.g. rally) or for the retrieval of feature projects scenarios (e.g. promise) diff --git a/docs/testing/user/userguide/index.rst b/docs/testing/user/userguide/index.rst index 5268559bf..c877be7b5 100644 --- a/docs/testing/user/userguide/index.rst +++ b/docs/testing/user/userguide/index.rst @@ -296,8 +296,6 @@ Inside the Functest container, first to prepare Functest environment: :: - cd /home/opnfv/repos/functest - pip install -e . functest env prepare then to run default defcore testcases by using refstack-client: @@ -346,7 +344,7 @@ file is: :: - cd /home/opnfv/repos/functest/functest/opnfv_tests/openstack/refstack_client + cd /usr/lib/python2.7/site-packages/functest/opnfv_tests/openstack/refstack_client python tempest_conf.py a file called tempest.conf is stored in the current path by default, users can do diff --git a/docs/testing/user/userguide/runfunctest.rst b/docs/testing/user/userguide/runfunctest.rst index c155e6090..079baddf9 100644 --- a/docs/testing/user/userguide/runfunctest.rst +++ b/docs/testing/user/userguide/runfunctest.rst @@ -496,8 +496,6 @@ To execute a Test Tier or Test Case, the 'run' command is used:: and root@22e436918db0:~/repos/functest/ci# functest testcase run vping_ssh - Executing command: 'python /home/opnfv/repos/functest/ci/run_tests.py -t vping_ssh' - 2016-06-30 11:50:31,861 - run_tests - INFO - Sourcing the OpenStack RC file... 2016-06-30 11:50:31,865 - run_tests - INFO - ============================================ 2016-06-30 11:50:31,865 - run_tests - INFO - Running test case 'vping_ssh'... 2016-06-30 11:50:31,865 - run_tests - INFO - ============================================ @@ -616,7 +614,7 @@ variables: * mode = (ha|noha) The constraints per test case are defined in the Functest configuration file -*/home/opnfv/repos/functest/functest/ci/testcases.yaml*:: +*/usr/local/lib/python2.7/dist-packages/functest/ci/testcases.yaml*:: tiers: - diff --git a/docs/testing/user/userguide/troubleshooting.rst b/docs/testing/user/userguide/troubleshooting.rst index bcd9e1c84..1c5166081 100644 --- a/docs/testing/user/userguide/troubleshooting.rst +++ b/docs/testing/user/userguide/troubleshooting.rst @@ -65,7 +65,7 @@ Notes: It is actually still possible to invoke test execution, with suppression of OpenStack resource cleanup, however this requires invocation of a - **specific Python script:** '/home/opnfv/repos/functest/ci/run_test.py'. + **specific Python script:** 'run_tests'. The `OPNFV Functest Developer Guide`_ provides guidance on the use of that Python script in such troubleshooting cases. diff --git a/functest/ci/download_images.sh b/functest/ci/download_images.sh index 23e09c10b..23e09c10b 100755..100644 --- a/functest/ci/download_images.sh +++ b/functest/ci/download_images.sh diff --git a/functest/ci/prepare_env.py b/functest/ci/prepare_env.py index ae9d9537e..da3e62450 100755..100644 --- a/functest/ci/prepare_env.py +++ b/functest/ci/prepare_env.py @@ -389,7 +389,3 @@ def main(): parser = PrepareEnvParser() args = parser.parse_args(sys.argv[1:]) return prepare_env(**args) - - -if __name__ == '__main__': - sys.exit(main()) diff --git a/functest/ci/run_tests.py b/functest/ci/run_tests.py index 5155adc46..b95e1008b 100755..100644 --- a/functest/ci/run_tests.py +++ b/functest/ci/run_tests.py @@ -276,6 +276,3 @@ def main(): args = parser.parse_args(sys.argv[1:]) runner = Runner() return runner.main(**args).value - -if __name__ == '__main__': - sys.exit(main()) diff --git a/functest/cli/commands/cli_env.py b/functest/cli/commands/cli_env.py index ce9775725..99d36996d 100644 --- a/functest/cli/commands/cli_env.py +++ b/functest/cli/commands/cli_env.py @@ -8,7 +8,6 @@ # import os -import pkg_resources import click import prettytable @@ -36,9 +35,7 @@ class CliEnv(object): else: answer = raw_input("Invalid answer. Please type [y|n]\n") - cmd = ("python %s start" % pkg_resources.resource_filename( - 'functest', 'ci/prepare_env.py')) - ft_utils.execute_command(cmd) + ft_utils.execute_command("prepare_env start") def show(self): def _get_value(attr, default='Unknown'): diff --git a/functest/cli/commands/cli_testcase.py b/functest/cli/commands/cli_testcase.py index 91904d870..cb3d47391 100644 --- a/functest/cli/commands/cli_testcase.py +++ b/functest/cli/commands/cli_testcase.py @@ -60,8 +60,5 @@ class CliTestcase(object): else: tests = testname.split(",") for test in tests: - cmd = ("python %s %s -t %s" % - (pkg_resources.resource_filename( - 'functest', 'ci/run_tests.py'), - flags, test)) + cmd = "run_tests {}-t {}".format(flags, test) ft_utils.execute_command(cmd) diff --git a/functest/cli/commands/cli_tier.py b/functest/cli/commands/cli_tier.py index 48e9f542a..9b2e60baa 100644 --- a/functest/cli/commands/cli_tier.py +++ b/functest/cli/commands/cli_tier.py @@ -68,6 +68,5 @@ class CliTier(object): click.echo("Functest environment is not ready. " "Run first 'functest env prepare'") else: - cmd = ("python %s %s -t %s" % (pkg_resources.resource_filename( - 'functest', 'ci/run_tests.py'), flags, tiername)) + cmd = "run_tests {}-t {}".format(flags, tiername) ft_utils.execute_command(cmd) diff --git a/functest/opnfv_tests/openstack/tempest/custom_tests/blacklist.txt b/functest/opnfv_tests/openstack/tempest/custom_tests/blacklist.txt index 026b24f41..bb1aed339 100644 --- a/functest/opnfv_tests/openstack/tempest/custom_tests/blacklist.txt +++ b/functest/opnfv_tests/openstack/tempest/custom_tests/blacklist.txt @@ -1,64 +1,2 @@ - - scenarios: - - os-odl_l2-nofeature-ha - - os-odl_l2-nofeature-noha - - os-nosdn-nofeature-ha - - os-nosdn-nofeature-noha - installers: - - joid - tests: - - tempest.api.object_storage - -- - scenarios: - - os-nosdn-lxd-ha - - os-nosdn-lxd-noha - installers: - - joid - tests: - - tempest.api.object_storage - - tempest.scenario.test_network_basic_ops.TestNetworkBasicOps.test_network_basic_ops - - tempest.scenario.test_server_basic_ops.TestServerBasicOps.test_server_basic_ops - - tempest.scenario.test_volume_boot_pattern.TestVolumeBootPattern.test_volume_boot_pattern - - tempest.scenario.test_volume_boot_pattern.TestVolumeBootPatternV2.test_volume_boot_pattern - -- - scenarios: - - os-onos-nofeature-ha - - os-onos-nofeature-noha - installers: - - compass - tests: - - tempest.api.compute.servers.test_server_actions.ServerActionsTestJSON.test_reboot_server_hard - - tempest.scenario.test_network_basic_ops.TestNetworkBasicOps.test_network_basic_ops - - tempest.scenario.test_server_basic_ops.TestServerBasicOps.test_server_basic_ops - - tempest.scenario.test_volume_boot_pattern.TestVolumeBootPattern.test_volume_boot_pattern - - tempest.scenario.test_volume_boot_pattern.TestVolumeBootPatternV2.test_volume_boot_pattern - -- - # https://bugs.launchpad.net/tempest/+bug/1577632 - scenarios: - - os-odl_l2-nofeature-ha - - os-odl_l2-nofeature-noha - - os-odl_l2-sfc-ha - - os-odl_l2-sfc-noha - - os-odl_l2-bgpvpn-ha - - os-odl_l2-bgpvpn-noha - - os-odl_l3-nofeature-ha - - os-odl_l3-nofeature-noha - installers: - - fuel - tests: - - tempest.scenario.test_server_basic_ops.TestServerBasicOps.test_server_basic_ops - -- - # https://bugs.opendaylight.org/show_bug.cgi?id=5586 - scenarios: - - os-odl-bgpvpn-ha - - os-odl-gluon-noha - - os-odl_l2-bgpvpn-ha - installers: - - apex - tests: - - tempest.api.compute.servers.test_server_actions.ServerActionsTestJSON.test_reboot_server_hard diff --git a/functest/opnfv_tests/openstack/vping/ping.sh b/functest/opnfv_tests/openstack/vping/ping.sh index 693b86825..693b86825 100755..100644 --- a/functest/opnfv_tests/openstack/vping/ping.sh +++ b/functest/opnfv_tests/openstack/vping/ping.sh diff --git a/functest/tests/unit/cli/commands/test_cli_env.py b/functest/tests/unit/cli/commands/test_cli_env.py index 0b18554b2..ddd5d86c5 100644 --- a/functest/tests/unit/cli/commands/test_cli_env.py +++ b/functest/tests/unit/cli/commands/test_cli_env.py @@ -6,7 +6,6 @@ # http://www.apache.org/licenses/LICENSE-2.0 import logging -import pkg_resources import unittest import mock @@ -25,8 +24,7 @@ class CliEnvTesting(unittest.TestCase): return_value=False) @mock.patch('functest.cli.commands.cli_testcase.ft_utils.execute_command') def test_prepare_default(self, mock_ft_utils, mock_os): - cmd = ("python %s start" % pkg_resources.resource_filename( - 'functest', 'ci/prepare_env.py')) + cmd = "prepare_env start" self.cli_environ.prepare() mock_ft_utils.assert_called_with(cmd) @@ -37,8 +35,7 @@ class CliEnvTesting(unittest.TestCase): with mock.patch('__builtin__.raw_input', return_value="y"), \ mock.patch('functest.cli.commands.cli_testcase.os.remove') \ as mock_os_remove: - cmd = ("python %s start" % pkg_resources.resource_filename( - 'functest', 'ci/prepare_env.py')) + cmd = "prepare_env start" self.cli_environ.prepare() mock_os_remove.assert_called_once_with( CONST.__getattribute__('env_active')) diff --git a/functest/tests/unit/cli/commands/test_cli_testcase.py b/functest/tests/unit/cli/commands/test_cli_testcase.py index 4d0bdc2f3..9ccf4c4ac 100644 --- a/functest/tests/unit/cli/commands/test_cli_testcase.py +++ b/functest/tests/unit/cli/commands/test_cli_testcase.py @@ -7,7 +7,6 @@ import logging -import pkg_resources import unittest import mock @@ -39,10 +38,7 @@ class CliTestCasesTesting(unittest.TestCase): return_value=True) @mock.patch('functest.cli.commands.cli_testcase.ft_utils.execute_command') def test_run_default(self, mock_ft_utils, mock_os): - cmd = ("python %s %s -t %s" % - (pkg_resources.resource_filename( - 'functest', 'ci/run_tests.py'), - "-n -r ", self.testname)) + cmd = "run_tests -n -r -t {}".format(self.testname) self.cli_tests.run(self.testname, noclean=True, report=True) mock_ft_utils.assert_called_with(cmd) @@ -50,10 +46,7 @@ class CliTestCasesTesting(unittest.TestCase): return_value=True) @mock.patch('functest.cli.commands.cli_testcase.ft_utils.execute_command') def test_run_noclean_missing_report(self, mock_ft_utils, mock_os): - cmd = ("python %s %s -t %s" % - (pkg_resources.resource_filename( - 'functest', 'ci/run_tests.py'), - "-n ", self.testname)) + cmd = "run_tests -n -t {}".format(self.testname) self.cli_tests.run(self.testname, noclean=True, report=False) mock_ft_utils.assert_called_with(cmd) @@ -61,10 +54,7 @@ class CliTestCasesTesting(unittest.TestCase): return_value=True) @mock.patch('functest.cli.commands.cli_testcase.ft_utils.execute_command') def test_run_report_missing_noclean(self, mock_ft_utils, mock_os): - cmd = ("python %s %s -t %s" % - (pkg_resources.resource_filename( - 'functest', 'ci/run_tests.py'), - "-r ", self.testname)) + cmd = "run_tests -r -t {}".format(self.testname) self.cli_tests.run(self.testname, noclean=False, report=True) mock_ft_utils.assert_called_with(cmd) @@ -72,10 +62,7 @@ class CliTestCasesTesting(unittest.TestCase): return_value=True) @mock.patch('functest.cli.commands.cli_testcase.ft_utils.execute_command') def test_run_missing_noclean_report(self, mock_ft_utils, mock_os): - cmd = ("python %s %s -t %s" % - (pkg_resources.resource_filename( - 'functest', 'ci/run_tests.py'), - "", self.testname)) + cmd = "run_tests -t {}".format(self.testname) self.cli_tests.run(self.testname, noclean=False, report=False) mock_ft_utils.assert_called_with(cmd) diff --git a/functest/tests/unit/cli/commands/test_cli_tier.py b/functest/tests/unit/cli/commands/test_cli_tier.py index b42e35818..1bb630db4 100644 --- a/functest/tests/unit/cli/commands/test_cli_tier.py +++ b/functest/tests/unit/cli/commands/test_cli_tier.py @@ -7,7 +7,6 @@ import logging -import pkg_resources import unittest import mock @@ -87,10 +86,7 @@ class CliTierTesting(unittest.TestCase): return_value=True) @mock.patch('functest.cli.commands.cli_tier.ft_utils.execute_command') def test_run_default(self, mock_ft_utils, mock_os): - cmd = ("python %s %s -t %s" % - (pkg_resources.resource_filename( - 'functest', 'ci/run_tests.py'), - "-n -r ", self.tiername)) + cmd = "run_tests -n -r -t {}".format(self.tiername) self.cli_tier.run(self.tiername, noclean=True, report=True) mock_ft_utils.assert_called_with(cmd) @@ -98,10 +94,7 @@ class CliTierTesting(unittest.TestCase): return_value=True) @mock.patch('functest.cli.commands.cli_tier.ft_utils.execute_command') def test_run_report_missing_noclean(self, mock_ft_utils, mock_os): - cmd = ("python %s %s -t %s" % - (pkg_resources.resource_filename( - 'functest', 'ci/run_tests.py'), - "-r ", self.tiername)) + cmd = "run_tests -r -t {}".format(self.tiername) self.cli_tier.run(self.tiername, noclean=False, report=True) mock_ft_utils.assert_called_with(cmd) @@ -109,10 +102,7 @@ class CliTierTesting(unittest.TestCase): return_value=True) @mock.patch('functest.cli.commands.cli_tier.ft_utils.execute_command') def test_run_noclean_missing_report(self, mock_ft_utils, mock_os): - cmd = ("python %s %s -t %s" % - (pkg_resources.resource_filename( - 'functest', 'ci/run_tests.py'), - "-n ", self.tiername)) + cmd = "run_tests -n -t {}".format(self.tiername) self.cli_tier.run(self.tiername, noclean=True, report=False) mock_ft_utils.assert_called_with(cmd) @@ -120,10 +110,7 @@ class CliTierTesting(unittest.TestCase): return_value=True) @mock.patch('functest.cli.commands.cli_tier.ft_utils.execute_command') def test_run_missing_noclean_report(self, mock_ft_utils, mock_os): - cmd = ("python %s %s -t %s" % - (pkg_resources.resource_filename( - 'functest', 'ci/run_tests.py'), - "", self.tiername)) + cmd = "run_tests -t {}".format(self.tiername) self.cli_tier.run(self.tiername, noclean=False, report=False) mock_ft_utils.assert_called_with(cmd) @@ -1,5 +1,5 @@ [tox] -envlist = docs,pep8,pylint,py35,py27 +envlist = docs,pep8,pylint,py35,py27,perm [testenv] usedevelop = True @@ -9,7 +9,7 @@ deps = git+https://gerrit.opnfv.org/gerrit/releng#egg=opnfv&subdirectory=modules git+https://gerrit.opnfv.org/gerrit/snaps#egg=snaps install_command = pip install \ - -chttps://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?stable/ocata \ + -chttps://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=stable/ocata \ {opts} {packages} commands = nosetests --with-xunit \ --with-coverage \ @@ -49,3 +49,14 @@ dirs = functest/tests/unit/odl functest/tests/unit/utils/test_decorators.py commands = nosetests {[testenv:py35]dirs} + +[testenv:perm] +basepython = python2.7 +whitelist_externals = bash +path=. -not -path './.tox/*' -not -path './.git/*' -not -path './docs/com/pres/reveal.js/*' +commands = + bash -c "\ + find {[testenv:perm]path} \( -type f -not -perm 644 -o -type d -not -perm 755 \) \ + -exec ls -l \{\} + | grep '.' && exit 1 || exit 0" + bash -c "\ + find {[testenv:perm]path} -exec file \{\} + | grep CRLF && exit 1 || exit 0" |