aboutsummaryrefslogtreecommitdiffstats
path: root/functest/opnfv_tests
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2017-04-10 15:10:11 +0200
committerCédric Ollivier <cedric.ollivier@orange.com>2017-04-12 16:26:12 +0200
commit888271575907898d80081e69b37f879091a636fc (patch)
treef6b4735f11464d3f94771575ca07af447003e865 /functest/opnfv_tests
parent96bacd7d8ffb9c05672c0a1fc6e68d19e4a6793a (diff)
Refactor the Feature framework
run() returns the expected status code (see following JIRA tickets). repo, pre() and post() are removed as they were quite useless. A dedicated class is proposed for bash programs. Unit tests have been added to fully cover this module. All features have been modified to conform with these modifications. It also removes the decorators which skipped several unit tests. JIRA: FUNCTEST-778 JIRA: FUNCTEST-779 JIRA: FUNCTEST-780 JIRA: FUNCTEST-781 Change-Id: Ifb1e4c4f68260a4e20d895f67f07f369ca959374 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
Diffstat (limited to 'functest/opnfv_tests')
-rw-r--r--functest/opnfv_tests/features/barometer.py1
-rw-r--r--functest/opnfv_tests/features/copper.py7
-rw-r--r--functest/opnfv_tests/features/doctor.py7
-rw-r--r--functest/opnfv_tests/features/domino.py7
-rw-r--r--functest/opnfv_tests/features/netready.py11
-rw-r--r--functest/opnfv_tests/features/odl_sfc.py9
-rw-r--r--functest/opnfv_tests/features/promise.py9
-rw-r--r--functest/opnfv_tests/features/sdnvpn.py9
-rw-r--r--functest/opnfv_tests/features/security_scan.py14
-rw-r--r--functest/opnfv_tests/vnf/rnc/parser.py7
10 files changed, 44 insertions, 37 deletions
diff --git a/functest/opnfv_tests/features/barometer.py b/functest/opnfv_tests/features/barometer.py
index cd3062cc..b42801d4 100644
--- a/functest/opnfv_tests/features/barometer.py
+++ b/functest/opnfv_tests/features/barometer.py
@@ -17,7 +17,6 @@ class BarometerCollectd(base.Feature):
'''
def __init__(self, **kwargs):
- kwargs["repo"] = 'dir_repo_barometer'
super(BarometerCollectd, self).__init__(**kwargs)
def execute(self):
diff --git a/functest/opnfv_tests/features/copper.py b/functest/opnfv_tests/features/copper.py
index e5c3f8bd..2c5459fc 100644
--- a/functest/opnfv_tests/features/copper.py
+++ b/functest/opnfv_tests/features/copper.py
@@ -15,10 +15,11 @@
# limitations under the License.
#
import functest.core.feature as base
+from functest.utils.constants import CONST
-class Copper(base.Feature):
+class Copper(base.BashFeature):
def __init__(self, **kwargs):
- kwargs["repo"] = 'dir_repo_copper'
+ repo = CONST.__getattribute__('dir_repo_copper')
+ kwargs["cmd"] = 'cd %s/tests && bash run.sh && cd -' % repo
super(Copper, self).__init__(**kwargs)
- self.cmd = 'cd %s/tests && bash run.sh && cd -' % self.repo
diff --git a/functest/opnfv_tests/features/doctor.py b/functest/opnfv_tests/features/doctor.py
index 3a2cc7df..0e39248d 100644
--- a/functest/opnfv_tests/features/doctor.py
+++ b/functest/opnfv_tests/features/doctor.py
@@ -14,10 +14,11 @@
#
#
import functest.core.feature as base
+from functest.utils.constants import CONST
-class Doctor(base.Feature):
+class Doctor(base.BashFeature):
def __init__(self, **kwargs):
- kwargs["repo"] = 'dir_repo_doctor'
+ repo = CONST.__getattribute__('dir_repo_doctor')
+ kwargs["cmd"] = 'cd %s/tests && ./run.sh' % repo
super(Doctor, self).__init__(**kwargs)
- self.cmd = 'cd %s/tests && ./run.sh' % self.repo
diff --git a/functest/opnfv_tests/features/domino.py b/functest/opnfv_tests/features/domino.py
index 629c8d54..b5def3f3 100644
--- a/functest/opnfv_tests/features/domino.py
+++ b/functest/opnfv_tests/features/domino.py
@@ -15,10 +15,11 @@
# 0.4: refactoring to match Test abstraction class
import functest.core.feature as base
+from functest.utils.constants import CONST
-class Domino(base.Feature):
+class Domino(base.BashFeature):
def __init__(self, **kwargs):
- kwargs["repo"] = 'dir_repo_domino'
+ repo = CONST.__getattribute__('dir_repo_domino')
+ kwargs["cmd"] = 'cd %s && ./tests/run_multinode.sh' % repo
super(Domino, self).__init__(**kwargs)
- self.cmd = 'cd %s && ./tests/run_multinode.sh' % self.repo
diff --git a/functest/opnfv_tests/features/netready.py b/functest/opnfv_tests/features/netready.py
index f7bab08b..717a4a34 100644
--- a/functest/opnfv_tests/features/netready.py
+++ b/functest/opnfv_tests/features/netready.py
@@ -9,13 +9,14 @@
#
import functest.core.feature as base
+from functest.utils.constants import CONST
-class GluonVping(base.Feature):
+class GluonVping(base.BashFeature):
def __init__(self, **kwargs):
- kwargs["repo"] = 'dir_repo_netready'
+ 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)
- dir_netready_functest = '{}/test/functest'.format(self.repo)
- self.cmd = ('cd %s && python ./gluon-test-suite.py' %
- dir_netready_functest)
diff --git a/functest/opnfv_tests/features/odl_sfc.py b/functest/opnfv_tests/features/odl_sfc.py
index d4f4eb67..f5ecf733 100644
--- a/functest/opnfv_tests/features/odl_sfc.py
+++ b/functest/opnfv_tests/features/odl_sfc.py
@@ -8,12 +8,13 @@
# http://www.apache.org/licenses/LICENSE-2.0
#
import functest.core.feature as base
+from functest.utils.constants import CONST
-class OpenDaylightSFC(base.Feature):
+class OpenDaylightSFC(base.BashFeature):
def __init__(self, **kwargs):
- kwargs["repo"] = 'dir_repo_sfc'
+ 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)
- dir_sfc_functest = '{}/sfc/tests/functest'.format(self.repo)
- self.cmd = 'cd %s && python ./run_tests.py' % dir_sfc_functest
diff --git a/functest/opnfv_tests/features/promise.py b/functest/opnfv_tests/features/promise.py
index 49eb8a08..b9e128f0 100644
--- a/functest/opnfv_tests/features/promise.py
+++ b/functest/opnfv_tests/features/promise.py
@@ -13,11 +13,12 @@
# limitations under the License.
#
import functest.core.feature as base
+from functest.utils.constants import CONST
-class Promise(base.Feature):
+class Promise(base.BashFeature):
def __init__(self, **kwargs):
- kwargs["repo"] = 'dir_repo_promise'
+ 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)
- dir_promise_functest = '{}/promise/test/functest'.format(self.repo)
- self.cmd = 'cd %s && python ./run_tests.py' % dir_promise_functest
diff --git a/functest/opnfv_tests/features/sdnvpn.py b/functest/opnfv_tests/features/sdnvpn.py
index 6a1071ff..10a97e92 100644
--- a/functest/opnfv_tests/features/sdnvpn.py
+++ b/functest/opnfv_tests/features/sdnvpn.py
@@ -8,12 +8,13 @@
# http://www.apache.org/licenses/LICENSE-2.0
#
import functest.core.feature as base
+from functest.utils.constants import CONST
-class SdnVpnTests(base.Feature):
+class SdnVpnTests(base.BashFeature):
def __init__(self, **kwargs):
- kwargs["repo"] = 'dir_repo_sdnvpn'
+ 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)
- dir_sfc_functest = '{}/sdnvpn/test/functest'.format(self.repo)
- self.cmd = 'cd %s && python ./run_tests.py' % dir_sfc_functest
diff --git a/functest/opnfv_tests/features/security_scan.py b/functest/opnfv_tests/features/security_scan.py
index 2ed9a823..8f167259 100644
--- a/functest/opnfv_tests/features/security_scan.py
+++ b/functest/opnfv_tests/features/security_scan.py
@@ -12,12 +12,12 @@ import functest.core.feature as base
from functest.utils.constants import CONST
-class SecurityScan(base.Feature):
+class SecurityScan(base.BashFeature):
def __init__(self, **kwargs):
- kwargs["repo"] = 'dir_repo_securityscan'
+ 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)
- self.cmd = ('. {0}/stackrc && '
- 'cd {1} && '
- 'python security_scan.py --config config.ini && '
- 'cd -'.format(CONST.dir_functest_conf,
- self.repo))
diff --git a/functest/opnfv_tests/vnf/rnc/parser.py b/functest/opnfv_tests/vnf/rnc/parser.py
index ff726b9e..3e6b138c 100644
--- a/functest/opnfv_tests/vnf/rnc/parser.py
+++ b/functest/opnfv_tests/vnf/rnc/parser.py
@@ -16,10 +16,11 @@
#
import functest.core.feature as base
+from functest.utils.constants import CONST
-class Parser(base.Feature):
+class Parser(base.BashFeature):
def __init__(self, **kwargs):
- kwargs["repo"] = 'dir_repo_parser'
+ repo = CONST.__getattribute__('dir_repo_parser')
+ kwargs["cmd"] = 'cd %s/tests && ./functest_run.sh' % repo
super(Parser, self).__init__(**kwargs)
- self.cmd = 'cd %s/tests && ./functest_run.sh' % self.repo