From d3042a7aa885d7761289661fb728f4d7b5e7c94b Mon Sep 17 00:00:00 2001 From: =?utf8?q?C=C3=A9dric=20Ollivier?= Date: Wed, 26 Oct 2016 09:41:19 +0200 Subject: [PATCH] Delete the reachability tests MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit It removes 001__reachability.robot as it is now part of OpenDaylight integration/test. It completes the commit which pushes upstream the reachability tests [1]. [1] https://git.opendaylight.org/gerrit/#/c/46910/ Change-Id: I72926cd4ab77e12ba4aeabf03bdd35619d43ffd3 Signed-off-by: Cédric Ollivier --- testcases/Controllers/ODL/OpenDaylightTesting.py | 17 +----- .../custom_tests/neutron/001__reachability.robot | 30 ---------- unit_tests/odl/test_odl.py | 65 +++++----------------- 3 files changed, 14 insertions(+), 98 deletions(-) delete mode 100644 testcases/Controllers/ODL/custom_tests/neutron/001__reachability.robot diff --git a/testcases/Controllers/ODL/OpenDaylightTesting.py b/testcases/Controllers/ODL/OpenDaylightTesting.py index c44be626..8c003abf 100755 --- a/testcases/Controllers/ODL/OpenDaylightTesting.py +++ b/testcases/Controllers/ODL/OpenDaylightTesting.py @@ -12,7 +12,6 @@ import errno import fileinput import os import re -import shutil import sys import urlparse @@ -59,19 +58,6 @@ class ODLTestCases(TestCasesBase.TestCasesBase): def __init__(self): self.case_name = "odl" - @classmethod - def copy_opnf_testcases(cls): - opnfv_testcases_dir = (os.path.dirname(os.path.abspath(__file__)) + - "/custom_tests/neutron/") - f = opnfv_testcases_dir + "001__reachability.robot" - try: - shutil.copy(f, cls.neutron_suite_dir) - except IOError as e: - cls.logger.error( - "Cannot copy OPNFV's testcase to ODL directory: %s" % str(e)) - return False - return True - @classmethod def set_robotframework_vars(cls, odlusername="admin", odlpassword="admin"): odl_variables_files = cls.odl_test_repo + 'csit/variables/Variables.py' @@ -115,8 +101,7 @@ class ODLTestCases(TestCasesBase.TestCasesBase): self.logger.error("Cannot run ODL testcases. Please check " "%s" % str(e)) return self.EX_RUN_ERROR - if (self.copy_opnf_testcases() and - self.set_robotframework_vars(odlusername, odlpassword)): + if self.set_robotframework_vars(odlusername, odlpassword): try: os.makedirs(self.res_dir) except OSError as e: diff --git a/testcases/Controllers/ODL/custom_tests/neutron/001__reachability.robot b/testcases/Controllers/ODL/custom_tests/neutron/001__reachability.robot deleted file mode 100644 index c2714c69..00000000 --- a/testcases/Controllers/ODL/custom_tests/neutron/001__reachability.robot +++ /dev/null @@ -1,30 +0,0 @@ -*** Variables *** -${NeutronNorthbound} /controller/nb/v2/neutron -${NetworkNorthbound} ${NeutronNorthbound}/networks -${SubnetNorthbound} ${NeutronNorthbound}/subnets -${PortNorthbound} ${NeutronNorthbound}/ports - -*** Settings *** -Suite Setup Create Session ODL http://${ODL_SYSTEM_IP}:${PORT} headers=${HEADERS} auth=${AUTH} -Suite Teardown Delete All Sessions -Library RequestsLibrary -Variables ../../../variables/Variables.py - -*** Test Cases *** -Get the complete list of networks - [Documentation] Get the complete list of networks - [Tags] reachability - ${resp} get request ODL ${NetworkNorthbound} - Should be Equal As Strings ${resp.status_code} 200 - -Get the complete list of subnets - [Documentation] Get the complete list of subnets - [Tags] reachability - ${resp} get request ODL ${SubnetNorthbound} - Should be Equal As Strings ${resp.status_code} 200 - -Get the complete list of ports - [Documentation] Get the complete list of ports - [Tags] reachability - ${resp} get request ODL ${PortNorthbound} - Should be Equal As Strings ${resp.status_code} 200 diff --git a/unit_tests/odl/test_odl.py b/unit_tests/odl/test_odl.py index 76732593..cbe4df68 100644 --- a/unit_tests/odl/test_odl.py +++ b/unit_tests/odl/test_odl.py @@ -43,19 +43,6 @@ class ODLTestCasesTesting(unittest.TestCase): os.environ["OS_TENANT_NAME"] = self._os_tenantname self.test = OpenDaylightTesting.ODLTestCases() - @mock.patch('shutil.copy', side_effect=Exception()) - def test_copy_opnf_testcases_exception(self, *args): - with self.assertRaises(Exception): - self.test.copy_opnf_testcases() - - @mock.patch('shutil.copy', side_effect=IOError()) - def test_copy_opnf_testcases_ioerror(self, *args): - self.assertFalse(self.test.copy_opnf_testcases()) - - @mock.patch('shutil.copy') - def test_copy_opnf_testcases(self, *args): - self.assertTrue(self.test.copy_opnf_testcases()) - @mock.patch('fileinput.input', side_effect=Exception()) def test_set_robotframework_vars_failed(self, *args): self.assertFalse(self.test.set_robotframework_vars()) @@ -159,57 +146,41 @@ class ODLTestCasesTesting(unittest.TestCase): def test_main_missing_odlrestconfport(self): self._test_main_missing_keyword('odlrestconfport') - def test_main_copy_opnf_testcases_failed(self): - with mock.patch.object(self.test, 'copy_opnf_testcases', - return_value=False): - self._test_main(TestCasesBase.TestCasesBase.EX_RUN_ERROR) - self.test.copy_opnf_testcases.assert_called_once_with() - def test_main_set_robotframework_vars_failed(self): - with mock.patch.object(self.test, 'copy_opnf_testcases', - return_value=True), \ - mock.patch.object(self.test, 'set_robotframework_vars', - return_value=False): + with mock.patch.object(self.test, 'set_robotframework_vars', + return_value=False): self._test_main(TestCasesBase.TestCasesBase.EX_RUN_ERROR) self.test.set_robotframework_vars.assert_called_once_with( self._odl_username, self._odl_password) @mock.patch('os.makedirs', side_effect=Exception) def test_main_makedirs_exception(self, mock_method): - with mock.patch.object(self.test, - 'copy_opnf_testcases', return_value=True), \ - mock.patch.object(self.test, 'set_robotframework_vars', - return_value=True), \ + with mock.patch.object(self.test, 'set_robotframework_vars', + return_value=True), \ self.assertRaises(Exception): self._test_main(TestCasesBase.TestCasesBase.EX_RUN_ERROR, mock_method) @mock.patch('os.makedirs', side_effect=OSError) def test_main_makedirs_oserror(self, mock_method): - with mock.patch.object(self.test, - 'copy_opnf_testcases', return_value=True), \ - mock.patch.object(self.test, 'set_robotframework_vars', - return_value=True): + with mock.patch.object(self.test, 'set_robotframework_vars', + return_value=True): self._test_main(TestCasesBase.TestCasesBase.EX_RUN_ERROR, mock_method) @mock.patch('robot.run', side_effect=RobotError) @mock.patch('os.makedirs') def test_main_robot_run_failed(self, *args): - with mock.patch.object(self.test, 'copy_opnf_testcases', + with mock.patch.object(self.test, 'set_robotframework_vars', return_value=True), \ - mock.patch.object(self.test, 'set_robotframework_vars', - return_value=True), \ self.assertRaises(RobotError): self._test_main(TestCasesBase.TestCasesBase.EX_RUN_ERROR, *args) @mock.patch('robot.run') @mock.patch('os.makedirs') def test_main_parse_results_failed(self, *args): - with mock.patch.object(self.test, 'copy_opnf_testcases', + with mock.patch.object(self.test, 'set_robotframework_vars', return_value=True), \ - mock.patch.object(self.test, 'set_robotframework_vars', - return_value=True), \ mock.patch.object(self.test, 'parse_results', side_effect=RobotError): self._test_main(TestCasesBase.TestCasesBase.EX_RUN_ERROR, *args) @@ -218,10 +189,8 @@ class ODLTestCasesTesting(unittest.TestCase): @mock.patch('robot.run') @mock.patch('os.makedirs') def test_main_remove_exception(self, *args): - with mock.patch.object(self.test, 'copy_opnf_testcases', + with mock.patch.object(self.test, 'set_robotframework_vars', return_value=True), \ - mock.patch.object(self.test, 'set_robotframework_vars', - return_value=True), \ mock.patch.object(self.test, 'parse_results'), \ self.assertRaises(Exception): self._test_main(TestCasesBase.TestCasesBase.EX_OK, *args) @@ -230,10 +199,8 @@ class ODLTestCasesTesting(unittest.TestCase): @mock.patch('robot.run') @mock.patch('os.makedirs') def test_main(self, *args): - with mock.patch.object(self.test, 'copy_opnf_testcases', + with mock.patch.object(self.test, 'set_robotframework_vars', return_value=True), \ - mock.patch.object(self.test, 'set_robotframework_vars', - return_value=True), \ mock.patch.object(self.test, 'parse_results'): self._test_main(TestCasesBase.TestCasesBase.EX_OK, *args) @@ -241,10 +208,8 @@ class ODLTestCasesTesting(unittest.TestCase): @mock.patch('robot.run') @mock.patch('os.makedirs', side_effect=OSError(errno.EEXIST, '')) def test_main_makedirs_oserror17(self, *args): - with mock.patch.object(self.test, 'copy_opnf_testcases', + with mock.patch.object(self.test, 'set_robotframework_vars', return_value=True), \ - mock.patch.object(self.test, 'set_robotframework_vars', - return_value=True), \ mock.patch.object(self.test, 'parse_results'): self._test_main(TestCasesBase.TestCasesBase.EX_OK, *args) @@ -252,10 +217,8 @@ class ODLTestCasesTesting(unittest.TestCase): @mock.patch('robot.run', return_value=1) @mock.patch('os.makedirs') def test_main_testcases_in_failure(self, *args): - with mock.patch.object(self.test, 'copy_opnf_testcases', + with mock.patch.object(self.test, 'set_robotframework_vars', return_value=True), \ - mock.patch.object(self.test, 'set_robotframework_vars', - return_value=True), \ mock.patch.object(self.test, 'parse_results'): self._test_main(TestCasesBase.TestCasesBase.EX_OK, *args) @@ -263,10 +226,8 @@ class ODLTestCasesTesting(unittest.TestCase): @mock.patch('robot.run') @mock.patch('os.makedirs') def test_main_remove_oserror(self, *args): - with mock.patch.object(self.test, 'copy_opnf_testcases', + with mock.patch.object(self.test, 'set_robotframework_vars', return_value=True), \ - mock.patch.object(self.test, 'set_robotframework_vars', - return_value=True), \ mock.patch.object(self.test, 'parse_results'): self._test_main(TestCasesBase.TestCasesBase.EX_OK, *args) -- 2.16.6