diff options
24 files changed, 73 insertions, 602 deletions
diff --git a/functest/ci/check_os.sh b/functest/ci/check_os.sh index 3920b7ac..83f9f476 100755 --- a/functest/ci/check_os.sh +++ b/functest/ci/check_os.sh @@ -69,7 +69,7 @@ fi echo "Checking OpenStack endpoints:" publicURL=$(openstack catalog show identity |awk '/public/ {print $4}') publicIP=$(echo $publicURL|sed 's/^.*http.*\:\/\///'|sed 's/.[^:]*$//') -publicPort=$(echo $publicURL|sed 's/^.*://'|sed 's/\/.*$//') +publicPort=$(echo $publicURL|grep -Po '(?<=:)\d+') https_enabled=$(echo $publicURL | grep 'https') if [[ -n $https_enabled ]]; then echo ">>Verifying SSL connectivity to the public endpoint $publicIP:$publicPort..." @@ -93,7 +93,7 @@ if [ -z ${adminURL} ]; then exit 1 fi adminIP=$(echo $adminURL|sed 's/^.*http.*\:\/\///'|sed 's/.[^:]*$//') -adminPort=$(echo $adminURL|sed 's/^.*://'|sed 's/.[^\/]*$//') +adminPort=$(echo $adminURL|grep -Po '(?<=:)\d+') https_enabled=$(echo $adminURL | grep 'https') if [[ -n $https_enabled ]]; then echo ">>Verifying SSL connectivity to the admin endpoint $adminIP:$adminPort..." diff --git a/functest/ci/testcases.yaml b/functest/ci/testcases.yaml index f717cdd5..febe1570 100755 --- a/functest/ci/testcases.yaml +++ b/functest/ci/testcases.yaml @@ -276,8 +276,10 @@ tiers: installer: '(fuel)|(joid)' scenario: '' run: - module: 'functest.opnfv_tests.features.promise' - class: 'Promise' + module: 'functest.core.feature' + class: 'BashFeature' + args: + cmd: 'cd /home/opnfv/repos/promise/promise/test/functest && python ./run_tests.py' - case_name: doctor-notification @@ -291,8 +293,10 @@ tiers: installer: '(apex)|(fuel)' scenario: '^((?!fdio).)*$' run: - module: 'functest.opnfv_tests.features.doctor' - class: 'Doctor' + module: 'functest.core.feature' + class: 'BashFeature' + args: + cmd: 'cd /home/opnfv/repos/doctor/tests && ./run.sh' - case_name: bgpvpn @@ -306,8 +310,10 @@ tiers: installer: '(fuel)|(apex)|(netvirt)' scenario: 'bgpvpn' run: - module: 'functest.opnfv_tests.features.sdnvpn' - class: 'SdnVpnTests' + module: 'functest.core.feature' + class: 'BashFeature' + args: + cmd: 'cd /home/opnfv/repos/sdnvpn/sdnvpn/test/functest && python ./run_tests.py' - case_name: security_scan @@ -321,8 +327,10 @@ tiers: installer: 'apex' scenario: '^((?!fdio).)*$' run: - module: 'functest.opnfv_tests.features.security_scan' - class: 'SecurityScan' + module: 'functest.core.feature' + class: 'BashFeature' + args: + cmd: '. /home/opnfv/functest/conf/stackrc && cd /home/opnfv/repos/securityscanning && python security_scan.py --config config.ini && cd -' - case_name: multisite @@ -350,8 +358,10 @@ tiers: installer: '(apex)|(fuel)' scenario: 'odl_l2-sfc' run: - module: 'functest.opnfv_tests.features.odl_sfc' - class: 'OpenDaylightSFC' + module: 'functest.core.feature' + class: 'BashFeature' + args: + cmd: 'cd /home/opnfv/repos/sfc/sfc/tests/functest && python ./run_tests.py' - case_name: onos_sfc project_name: functest @@ -378,8 +388,10 @@ tiers: installer: 'fuel' scenario: '^((?!bgpvpn|noha).)*$' run: - module: 'functest.opnfv_tests.vnf.rnc.parser' - class: 'Parser' + module: 'functest.core.feature' + class: 'BashFeature' + args: + cmd: 'cd /home/opnfv/repos/parser/tests && ./functest_run.sh' - case_name: domino-multinode project_name: domino @@ -392,8 +404,10 @@ tiers: installer: '' scenario: '' run: - module: 'functest.opnfv_tests.features.domino' - class: 'Domino' + module: 'functest.core.feature' + class: 'BashFeature' + args: + cmd: 'cd /home/opnfv/repos/domino && ./tests/run_multinode.sh' - case_name: gluon_vping project_name: netready @@ -406,8 +420,10 @@ tiers: installer: 'apex' scenario: 'gluon' run: - module: 'functest.opnfv_tests.features.netready' - class: 'GluonVping' + module: 'functest.core.feature' + class: 'BashFeature' + args: + cmd: 'cd /home/opnfv/repos/netready/test/functest && python ./gluon-test-suite.py' - case_name: barometercollectd project_name: barometer diff --git a/functest/core/feature.py b/functest/core/feature.py index 29e0e927..bab1d507 100644 --- a/functest/core/feature.py +++ b/functest/core/feature.py @@ -1,3 +1,12 @@ +#!/usr/bin/env python + +# Copyright (c) 2016 ZTE Corp and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 + import time import functest.core.testcase as base @@ -16,6 +25,7 @@ class Feature(base.TestCase): self.logger = ft_logger.Logger(self.project_name).getLogger() def execute(self, **kwargs): + # pylint: disable=unused-argument,no-self-use return -1 def run(self, **kwargs): @@ -23,7 +33,7 @@ class Feature(base.TestCase): exit_code = base.TestCase.EX_RUN_ERROR self.criteria = "FAIL" try: - if self.execute() == 0: + if self.execute(**kwargs) == 0: exit_code = base.TestCase.EX_OK self.criteria = 'PASS' ft_utils.logger_test_results( @@ -40,5 +50,12 @@ class Feature(base.TestCase): class BashFeature(Feature): def execute(self, **kwargs): - return ft_utils.execute_command( - self.cmd, output_file=self.result_file) + ret = -1 + try: + cmd = kwargs["cmd"] + ret = ft_utils.execute_command(cmd, output_file=self.result_file) + except KeyError: + self.logger.error("Please give cmd as arg. kwargs: %s", kwargs) + except Exception: # pylint: disable=broad-except + self.logger.exception("Execute cmd: %s failed", cmd) + return ret diff --git a/functest/opnfv_tests/features/copper.py b/functest/opnfv_tests/features/copper.py deleted file mode 100644 index 2c5459fc..00000000 --- a/functest/opnfv_tests/features/copper.py +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/python -# -# Copyright 2016 AT&T Intellectual Property, Inc -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import functest.core.feature as base -from functest.utils.constants import CONST - - -class Copper(base.BashFeature): - def __init__(self, **kwargs): - repo = CONST.__getattribute__('dir_repo_copper') - kwargs["cmd"] = 'cd %s/tests && bash run.sh && cd -' % repo - super(Copper, self).__init__(**kwargs) diff --git a/functest/opnfv_tests/features/doctor.py b/functest/opnfv_tests/features/doctor.py deleted file mode 100644 index 0e39248d..00000000 --- a/functest/opnfv_tests/features/doctor.py +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/python -# -# Copyright (c) 2017 All rights reserved -# This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# 0.1: This script boots the VM1 and allocates IP address from Nova -# Later, the VM2 boots then execute cloud-init to ping VM1. -# After successful ping, both the VMs are deleted. -# 0.2: measure test duration and publish results under json format -# -# -import functest.core.feature as base -from functest.utils.constants import CONST - - -class Doctor(base.BashFeature): - def __init__(self, **kwargs): - repo = CONST.__getattribute__('dir_repo_doctor') - kwargs["cmd"] = 'cd %s/tests && ./run.sh' % repo - super(Doctor, self).__init__(**kwargs) diff --git a/functest/opnfv_tests/features/domino.py b/functest/opnfv_tests/features/domino.py deleted file mode 100644 index b5def3f3..00000000 --- a/functest/opnfv_tests/features/domino.py +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/python -# -# Copyright (c) 2015 All rights reserved -# This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# 0.1: This script boots the VM1 and allocates IP address from Nova -# Later, the VM2 boots then execute cloud-init to ping VM1. -# After successful ping, both the VMs are deleted. -# 0.2: measure test duration and publish results under json format -# 0.3: add report flag to push results when needed -# 0.4: refactoring to match Test abstraction class - -import functest.core.feature as base -from functest.utils.constants import CONST - - -class Domino(base.BashFeature): - def __init__(self, **kwargs): - repo = CONST.__getattribute__('dir_repo_domino') - kwargs["cmd"] = 'cd %s && ./tests/run_multinode.sh' % repo - super(Domino, self).__init__(**kwargs) diff --git a/functest/opnfv_tests/features/netready.py b/functest/opnfv_tests/features/netready.py deleted file mode 100644 index 717a4a34..00000000 --- a/functest/opnfv_tests/features/netready.py +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/python -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# - -# -import functest.core.feature as base -from functest.utils.constants import CONST - - -class GluonVping(base.BashFeature): - - def __init__(self, **kwargs): - repo = CONST.__getattribute__('dir_repo_netready') - dir_netready_functest = '{}/test/functest'.format(repo) - kwargs["cmd"] = ('cd %s && python ./gluon-test-suite.py' % - dir_netready_functest) - super(GluonVping, self).__init__(**kwargs) diff --git a/functest/opnfv_tests/features/odl_sfc.py b/functest/opnfv_tests/features/odl_sfc.py deleted file mode 100644 index f5ecf733..00000000 --- a/functest/opnfv_tests/features/odl_sfc.py +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/python -# -# Copyright (c) 2016 All rights reserved -# This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -import functest.core.feature as base -from functest.utils.constants import CONST - - -class OpenDaylightSFC(base.BashFeature): - - def __init__(self, **kwargs): - repo = CONST.__getattribute__('dir_repo_sfc') - dir_sfc_functest = '{}/sfc/tests/functest'.format(repo) - kwargs["cmd"] = 'cd %s && python ./run_tests.py' % dir_sfc_functest - super(OpenDaylightSFC, self).__init__(**kwargs) diff --git a/functest/opnfv_tests/features/promise.py b/functest/opnfv_tests/features/promise.py deleted file mode 100644 index b9e128f0..00000000 --- a/functest/opnfv_tests/features/promise.py +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/python -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import functest.core.feature as base -from functest.utils.constants import CONST - - -class Promise(base.BashFeature): - def __init__(self, **kwargs): - repo = CONST.__getattribute__('dir_repo_promise') - dir_promise_functest = '{}/promise/test/functest'.format(repo) - kwargs["cmd"] = 'cd %s && python ./run_tests.py' % dir_promise_functest - super(Promise, self).__init__(**kwargs) diff --git a/functest/opnfv_tests/features/sdnvpn.py b/functest/opnfv_tests/features/sdnvpn.py deleted file mode 100644 index 10a97e92..00000000 --- a/functest/opnfv_tests/features/sdnvpn.py +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/python -# -# Copyright (c) 2016 All rights reserved -# This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -import functest.core.feature as base -from functest.utils.constants import CONST - - -class SdnVpnTests(base.BashFeature): - - def __init__(self, **kwargs): - repo = CONST.__getattribute__('dir_repo_sdnvpn') - dir_sfc_functest = '{}/sdnvpn/test/functest'.format(repo) - kwargs["cmd"] = 'cd %s && python ./run_tests.py' % dir_sfc_functest - super(SdnVpnTests, self).__init__(**kwargs) diff --git a/functest/opnfv_tests/features/security_scan.py b/functest/opnfv_tests/features/security_scan.py deleted file mode 100644 index 8f167259..00000000 --- a/functest/opnfv_tests/features/security_scan.py +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/python -# -# Copyright (c) 2015 All rights reserved -# This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# - -import functest.core.feature as base -from functest.utils.constants import CONST - - -class SecurityScan(base.BashFeature): - def __init__(self, **kwargs): - repo = CONST.__getattribute__('dir_repo_securityscan') - conf = CONST.__getattribute__('dir_functest_conf') - kwargs["cmd"] = ('. {0}/stackrc && ' - 'cd {1} && ' - 'python security_scan.py --config config.ini && ' - 'cd -'.format(conf, repo)) - super(SecurityScan, self).__init__(**kwargs) diff --git a/functest/opnfv_tests/vnf/rnc/__init__.py b/functest/opnfv_tests/vnf/rnc/__init__.py deleted file mode 100644 index e69de29b..00000000 --- a/functest/opnfv_tests/vnf/rnc/__init__.py +++ /dev/null diff --git a/functest/opnfv_tests/vnf/rnc/parser.py b/functest/opnfv_tests/vnf/rnc/parser.py deleted file mode 100644 index 3e6b138c..00000000 --- a/functest/opnfv_tests/vnf/rnc/parser.py +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/python -# -# Copyright 2016 ZTE Corporation -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -import functest.core.feature as base -from functest.utils.constants import CONST - - -class Parser(base.BashFeature): - def __init__(self, **kwargs): - repo = CONST.__getattribute__('dir_repo_parser') - kwargs["cmd"] = 'cd %s/tests && ./functest_run.sh' % repo - super(Parser, self).__init__(**kwargs) diff --git a/functest/tests/unit/core/test_feature.py b/functest/tests/unit/core/test_feature.py index ac4b04c4..bd7197f0 100644 --- a/functest/tests/unit/core/test_feature.py +++ b/functest/tests/unit/core/test_feature.py @@ -17,6 +17,8 @@ import mock from functest.core import feature from functest.core import testcase +# logging must be disabled else it calls time.time() +# what will break these unit tests. logging.disable(logging.CRITICAL) @@ -27,10 +29,11 @@ class FeatureTestingBase(unittest.TestCase): _repo = "dir_repo_copper" _cmd = "cd /home/opnfv/repos/foo/tests && bash run.sh && cd -" _output_file = '/home/opnfv/functest/results/bar.log' + feature = None @mock.patch('time.time', side_effect=[1, 2]) def _test_run(self, status, mock_method=None): - self.assertEqual(self.feature.run(), status) + self.assertEqual(self.feature.run(cmd=self._cmd), status) if status == testcase.TestCase.EX_OK: self.assertEqual(self.feature.criteria, 'PASS') else: @@ -44,8 +47,15 @@ class FeatureTesting(FeatureTestingBase): def setUp(self): self.feature = feature.Feature( - project_name=self._project_name, case_name=self._case_name, - cmd=self._cmd) + project_name=self._project_name, case_name=self._case_name) + + def test_run_exc(self): + # pylint: disable=bad-continuation + with mock.patch.object( + self.feature, 'execute', + side_effect=Exception) as mock_method: + self._test_run(testcase.TestCase.EX_RUN_ERROR) + mock_method.assert_called_once_with(cmd=self._cmd) def test_run(self): self._test_run(testcase.TestCase.EX_RUN_ERROR) @@ -55,8 +65,12 @@ class BashFeatureTesting(FeatureTestingBase): def setUp(self): self.feature = feature.BashFeature( - project_name=self._project_name, case_name=self._case_name, - cmd=self._cmd) + project_name=self._project_name, case_name=self._case_name) + + @mock.patch("functest.utils.functest_utils.execute_command") + def test_run_no_cmd(self, mock_method=None): + self.assertEqual(self.feature.run(), testcase.TestCase.EX_RUN_ERROR) + mock_method.assert_not_called() @mock.patch("functest.utils.functest_utils.execute_command", return_value=1) diff --git a/functest/tests/unit/features/test_copper.py b/functest/tests/unit/features/test_copper.py deleted file mode 100644 index 56bf4137..00000000 --- a/functest/tests/unit/features/test_copper.py +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env python - -# Copyright (c) 2017 Orange and others. -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 - -# pylint: disable=missing-docstring - -import logging -import unittest - -from functest.opnfv_tests.features import copper -from functest.utils.constants import CONST - - -class CopperTesting(unittest.TestCase): - - logging.disable(logging.CRITICAL) - - _case_name = "copper-notification" - _project_name = "copper" - - def setUp(self): - self.copper = copper.Copper(case_name=self._case_name, - project_name=self._project_name) - - def test_init(self): - self.assertEqual(self.copper.project_name, self._project_name) - repo = CONST.__getattribute__('dir_repo_copper') - self.assertEqual( - self.copper.cmd, - "cd {}/tests && bash run.sh && cd -".format(repo)) - - -if __name__ == "__main__": - unittest.main(verbosity=2) diff --git a/functest/tests/unit/features/test_doctor.py b/functest/tests/unit/features/test_doctor.py deleted file mode 100644 index 650d1509..00000000 --- a/functest/tests/unit/features/test_doctor.py +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env python - -# Copyright (c) 2017 Orange and others. -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 - -# pylint: disable=missing-docstring - -import logging -import unittest - -from functest.opnfv_tests.features import doctor -from functest.utils.constants import CONST - - -class DoctorTesting(unittest.TestCase): - - logging.disable(logging.CRITICAL) - - _case_name = "doctor-notification" - _project_name = "doctor" - - def setUp(self): - self.doctor = doctor.Doctor(case_name=self._case_name, - project_name=self._project_name) - - def test_init(self): - self.assertEqual(self.doctor.project_name, self._project_name) - self.assertEqual(self.doctor.case_name, self._case_name) - repo = CONST.__getattribute__('dir_repo_doctor') - self.assertEqual( - self.doctor.cmd, - 'cd {}/tests && ./run.sh'.format(repo)) - - -if __name__ == "__main__": - unittest.main(verbosity=2) diff --git a/functest/tests/unit/features/test_domino.py b/functest/tests/unit/features/test_domino.py deleted file mode 100644 index f311af33..00000000 --- a/functest/tests/unit/features/test_domino.py +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env python - -# Copyright (c) 2017 Orange and others. -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 - -# pylint: disable=missing-docstring - -import logging -import unittest - -from functest.opnfv_tests.features import domino -from functest.utils.constants import CONST - - -class DominoTesting(unittest.TestCase): - - logging.disable(logging.CRITICAL) - - _case_name = "domino-multinode" - _project_name = "domino" - - def setUp(self): - self.domino = domino.Domino(case_name=self._case_name, - project_name=self._project_name) - - def test_init(self): - self.assertEqual(self.domino.project_name, self._project_name) - self.assertEqual(self.domino.case_name, self._case_name) - repo = CONST.__getattribute__('dir_repo_domino') - self.assertEqual( - self.domino.cmd, - 'cd {} && ./tests/run_multinode.sh'.format(repo)) - - -if __name__ == "__main__": - unittest.main(verbosity=2) diff --git a/functest/tests/unit/features/test_netready.py b/functest/tests/unit/features/test_netready.py deleted file mode 100644 index 96840195..00000000 --- a/functest/tests/unit/features/test_netready.py +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env python - -# Copyright (c) 2017 Orange and others. -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 - -# pylint: disable=missing-docstring - -import logging -import unittest - -from functest.opnfv_tests.features import netready -from functest.utils.constants import CONST - - -class NetreadyTesting(unittest.TestCase): - - logging.disable(logging.CRITICAL) - - _case_name = "gluon_vping" - _project_name = "netready" - - def setUp(self): - self.netready = netready.GluonVping(case_name=self._case_name, - project_name=self._project_name) - - def test_init(self): - self.assertEqual(self.netready.project_name, self._project_name) - self.assertEqual(self.netready.case_name, self._case_name) - repo = CONST.__getattribute__('dir_repo_netready') - self.assertEqual( - self.netready.cmd, - 'cd {}/test/functest && python ./gluon-test-suite.py'.format(repo)) - - -if __name__ == "__main__": - unittest.main(verbosity=2) diff --git a/functest/tests/unit/features/test_odl_sfc.py b/functest/tests/unit/features/test_odl_sfc.py deleted file mode 100644 index 5673e2b1..00000000 --- a/functest/tests/unit/features/test_odl_sfc.py +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/env python - -# Copyright (c) 2017 Orange and others. -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 - -# pylint: disable=missing-docstring - -import logging -import unittest - -from functest.opnfv_tests.features import odl_sfc -from functest.utils.constants import CONST - - -class OpenDaylightSFCTesting(unittest.TestCase): - - logging.disable(logging.CRITICAL) - - _case_name = "functest-odl-sfc" - _project_name = "sfc" - - def setUp(self): - self.odl_sfc = odl_sfc.OpenDaylightSFC( - case_name="functest-odl-sfc", - project_name=self._project_name) - - def test_init(self): - self.assertEqual(self.odl_sfc.project_name, "sfc") - self.assertEqual(self.odl_sfc.case_name, "functest-odl-sfc") - repo = CONST.__getattribute__('dir_repo_sfc') - dir_sfc_functest = '{}/sfc/tests/functest'.format(repo) - self.assertEqual( - self.odl_sfc.cmd, - 'cd {} && python ./run_tests.py'.format(dir_sfc_functest)) - - -if __name__ == "__main__": - unittest.main(verbosity=2) diff --git a/functest/tests/unit/features/test_promise.py b/functest/tests/unit/features/test_promise.py deleted file mode 100644 index 8fa1fba0..00000000 --- a/functest/tests/unit/features/test_promise.py +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env python - -# Copyright (c) 2017 Orange and others. -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 - -# pylint: disable=missing-docstring - -import logging -import unittest - -from functest.opnfv_tests.features import promise -from functest.utils.constants import CONST - - -class PromiseTesting(unittest.TestCase): - - logging.disable(logging.CRITICAL) - - _case_name = "promise" - _project_name = "promise" - - def setUp(self): - self.promise = promise.Promise(case_name=self._case_name, - project_name=self._project_name) - - def test_init(self): - self.assertEqual(self.promise.project_name, self._project_name) - self.assertEqual(self.promise.case_name, self._case_name) - repo = CONST.__getattribute__('dir_repo_promise') - self.assertEqual( - self.promise.cmd, - 'cd {}/promise/test/functest && python ./run_tests.py'.format( - repo)) - - -if __name__ == "__main__": - unittest.main(verbosity=2) diff --git a/functest/tests/unit/features/test_sdnvpn.py b/functest/tests/unit/features/test_sdnvpn.py deleted file mode 100644 index 75657fc4..00000000 --- a/functest/tests/unit/features/test_sdnvpn.py +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env python - -# Copyright (c) 2017 Orange and others. -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 - -# pylint: disable=missing-docstring - -import logging -import unittest - -from functest.opnfv_tests.features import sdnvpn -from functest.utils.constants import CONST - - -class SdnVpnTesting(unittest.TestCase): - - logging.disable(logging.CRITICAL) - - _case_name = "bgpvpn" - _project_name = "sdnvpn" - - def setUp(self): - self.sdnvpn = sdnvpn.SdnVpnTests(case_name=self._case_name, - project_name=self._project_name) - - def test_init(self): - self.assertEqual(self.sdnvpn.project_name, self._project_name) - self.assertEqual(self.sdnvpn.case_name, self._case_name) - repo = CONST.__getattribute__('dir_repo_sdnvpn') - self.assertEqual( - self.sdnvpn.cmd, - 'cd {}/sdnvpn/test/functest && python ./run_tests.py'.format(repo)) - - -if __name__ == "__main__": - unittest.main(verbosity=2) diff --git a/functest/tests/unit/features/test_security_scan.py b/functest/tests/unit/features/test_security_scan.py deleted file mode 100644 index 61ae9dc1..00000000 --- a/functest/tests/unit/features/test_security_scan.py +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env python - -# Copyright (c) 2017 Orange and others. -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 - -# pylint: disable=missing-docstring - -import logging -import unittest - -from functest.opnfv_tests.features import security_scan -from functest.utils.constants import CONST - - -class SecurityScanTesting(unittest.TestCase): - - logging.disable(logging.CRITICAL) - - _case_name = "security_scan" - _project_name = "security_scan" - - def setUp(self): - self.sscan = security_scan.SecurityScan( - case_name=self._case_name, project_name=self._project_name) - - def test_init(self): - self.assertEqual(self.sscan.project_name, self._project_name) - self.assertEqual(self.sscan.case_name, self._case_name) - repo = CONST.__getattribute__('dir_repo_securityscan') - self.assertEqual( - self.sscan.cmd, ( - '. {0}/stackrc && cd {1} && ' - 'python security_scan.py --config config.ini && ' - 'cd -'.format( - CONST.__getattribute__("dir_functest_conf"), - repo))) - - -if __name__ == "__main__": - unittest.main(verbosity=2) diff --git a/functest/tests/unit/vnf/rnc/test_parser.py b/functest/tests/unit/vnf/rnc/test_parser.py deleted file mode 100644 index 9e310cce..00000000 --- a/functest/tests/unit/vnf/rnc/test_parser.py +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env python - -# Copyright (c) 2017 Orange and others. -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 - -# pylint: disable=missing-docstring - -import logging -import unittest - -from functest.opnfv_tests.vnf.rnc import parser -from functest.utils.constants import CONST - - -class ParserTesting(unittest.TestCase): - - logging.disable(logging.CRITICAL) - - _case_name = "parser-basics" - _project_name = "parser" - - def setUp(self): - self.parser = parser.Parser( - case_name=self._case_name, project_name=self._project_name) - - def test_init(self): - self.assertEqual(self.parser.project_name, self._project_name) - self.assertEqual(self.parser.case_name, self._case_name) - repo = CONST.__getattribute__('dir_repo_parser') - self.assertEqual( - self.parser.cmd, - 'cd {}/tests && ./functest_run.sh'.format(repo)) - - -if __name__ == "__main__": - unittest.main(verbosity=2) diff --git a/run_unit_tests.sh b/run_unit_tests.sh index 5a66dd7f..917c8eee 100755 --- a/run_unit_tests.sh +++ b/run_unit_tests.sh @@ -43,7 +43,6 @@ nosetests --with-xunit \ --cover-package=functest.core \ --cover-package=functest.opnfv_tests.sdn.odl.odl \ --cover-package=functest.opnfv_tests.vnf.ims \ - --cover-package=functest.opnfv_tests.vnf.rnc \ --cover-package=functest.utils \ --cover-package=functest.opnfv_tests.features \ --cover-package=functest.opnfv_tests.openstack \ |