Add enabled flag in testcases.yaml 33/34833/9
authorjose.lausuch <jose.lausuch@ericsson.com>
Tue, 16 May 2017 09:28:14 +0000 (11:28 +0200)
committerJose Lausuch <jose.lausuch@ericsson.com>
Tue, 16 May 2017 14:29:48 +0000 (14:29 +0000)
This will allow enable/disable test cases directly
using true/false.

Change-Id: Iaa7d051ebb8dd9e5a6f835a823f58f1e17a87b8d
Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
functest/ci/run_tests.py
functest/ci/testcases.yaml
functest/ci/tier_builder.py
functest/ci/tier_handler.py
functest/tests/unit/ci/test_tier_builder.py
functest/tests/unit/ci/test_tier_handler.py

index 493d5f9..7676009 100755 (executable)
@@ -40,6 +40,10 @@ class BlockingTestFailed(Exception):
     pass
 
 
+class TestNotEnabled(Exception):
+    pass
+
+
 class RunTestsParser(object):
 
     def __init__(self):
@@ -114,6 +118,9 @@ def get_run_dict(testname):
 
 
 def run_test(test, tier_name, testcases=None):
+    if not test.is_enabled():
+        raise TestNotEnabled("The test case {} is not enabled"
+                             .format(test.get_name()))
     test_name = test.get_name()
     logger.info("\n")  # blank line
     print_separator("=")
index 7009e91..d98a2de 100644 (file)
@@ -19,7 +19,6 @@ tiers:
                     simple queries. When the config value of
                     snaps.use_keystone is True, functest must have access to
                     the cloud's private network.
-
                 dependencies:
                     installer: '^((?!netvirt).)*$'
                     scenario: ''
@@ -39,13 +38,13 @@ tiers:
                     simple queries. When the config value of
                     snaps.use_keystone is True, functest must have access to
                     the cloud's private network.
-
                 dependencies:
                     installer: '^((?!netvirt).)*$'
                     scenario: ''
                 run:
                     module: 'functest.opnfv_tests.openstack.snaps.api_check'
                     class: 'ApiCheck'
+
             -
                 case_name: snaps_health_check
                 project_name: functest
@@ -63,6 +62,7 @@ tiers:
                 run:
                     module: 'functest.opnfv_tests.openstack.snaps.health_check'
                     class: 'HealthCheck'
+
     -
         name: smoke
         order: 1
@@ -266,6 +266,7 @@ tiers:
         testcases:
             -
                 case_name: promise
+                enabled: false
                 project_name: promise
                 criteria: 100
                 blocking: false
@@ -283,6 +284,7 @@ tiers:
 
             -
                 case_name: doctor-notification
+                enabled: false
                 project_name: doctor
                 criteria: 100
                 blocking: false
@@ -300,6 +302,7 @@ tiers:
 
             -
                 case_name: bgpvpn
+                enabled: false
                 project_name: sdnvpn
                 criteria: 100
                 blocking: false
@@ -317,6 +320,7 @@ tiers:
 
             -
                 case_name: security_scan
+                enabled: false
                 project_name: securityscanning
                 criteria: 100
                 blocking: false
@@ -334,6 +338,7 @@ tiers:
 
             -
                 case_name: copper
+                enabled: false
                 project_name: copper
                 criteria: 100
                 blocking: false
@@ -351,6 +356,7 @@ tiers:
 
             -
                 case_name: multisite
+                enabled: false
                 project_name: multisite
                 criteria: 100
                 blocking: false
@@ -363,8 +369,10 @@ tiers:
                 run:
                     module: 'functest.opnfv_tests.openstack.tempest.tempest'
                     class: 'TempestMultisite'
+
             -
                 case_name: functest-odl-sfc
+                enabled: false
                 project_name: sfc
                 criteria: 100
                 blocking: false
@@ -379,8 +387,10 @@ tiers:
                     class: 'BashFeature'
                     args:
                         cmd: 'cd /home/opnfv/repos/sfc/sfc/tests/functest && python ./run_tests.py'
+
             -
                 case_name: onos_sfc
+                enabled: false
                 project_name: functest
                 criteria: 100
                 blocking: true
@@ -393,8 +403,10 @@ tiers:
                 run:
                     module: 'functest.opnfv_tests.sdn.onos.onos'
                     class: 'OnosSfc'
+
             -
                 case_name: parser-basics
+                enabled: false
                 project_name: parser
                 criteria: 100
                 blocking: false
@@ -409,8 +421,10 @@ tiers:
                     class: 'BashFeature'
                     args:
                         cmd: 'cd /home/opnfv/repos/parser/tests && ./functest_run.sh'
+
             -
                 case_name: domino-multinode
+                enabled: false
                 project_name: domino
                 criteria: 100
                 blocking: false
@@ -425,8 +439,10 @@ tiers:
                     class: 'BashFeature'
                     args:
                         cmd: 'cd /home/opnfv/repos/domino && ./tests/run_multinode.sh'
+
             -
                 case_name: gluon_vping
+                enabled: false
                 project_name: netready
                 criteria: 100
                 blocking: false
@@ -441,8 +457,10 @@ tiers:
                     class: 'BashFeature'
                     args:
                         cmd: 'cd /home/opnfv/repos/netready/test/functest && python ./gluon-test-suite.py'
+
             -
                 case_name: barometercollectd
+                enabled: false
                 project_name: barometer
                 criteria: 100
                 blocking: false
@@ -458,6 +476,7 @@ tiers:
                 run:
                      module: 'functest.opnfv_tests.features.barometer'
                      class: 'BarometerCollectd'
+
     -
         name: components
         order: 3
@@ -481,6 +500,7 @@ tiers:
                 run:
                     module: 'functest.opnfv_tests.openstack.tempest.tempest'
                     class: 'TempestFullParallel'
+
             -
                 case_name: tempest_custom
                 project_name: functest
@@ -499,6 +519,7 @@ tiers:
                 run:
                     module: 'functest.opnfv_tests.openstack.tempest.tempest'
                     class: 'TempestCustom'
+
             -
                 case_name: rally_full
                 project_name: functest
@@ -537,22 +558,26 @@ tiers:
                 run:
                     module: 'functest.opnfv_tests.vnf.ims.cloudify_ims'
                     class: 'CloudifyIms'
-#          -
-#               case_name: aaa
-#               project_name: functest
-#               criteria: 100
-#               blocking: false
-#               clean_flag: true
-#               description: >-
-#                   Test suite from Parser project.
-#               dependencies:
-#                   installer: ''
-#                   scenario: ''
-#               run:
-#                   module: 'functest.opnfv_tests.vnf.aaa.aaa'
-#                   class: 'AaaVnf'
+
+            -
+                case_name: aaa
+                enabled: false
+                project_name: functest
+                criteria: 100
+                blocking: false
+                clean_flag: true
+                description: >-
+                   Test suite from Parser project.
+                dependencies:
+                    installer: ''
+                    scenario: ''
+                run:
+                    module: 'functest.opnfv_tests.vnf.aaa.aaa'
+                    class: 'AaaVnf'
+
             -
                 case_name: orchestra_ims
+                enabled: false
                 project_name: functest
                 criteria: 100
                 blocking: false
@@ -568,6 +593,7 @@ tiers:
 
             -
                 case_name: opera_vims
+                enabled: false
                 project_name: opera
                 criteria: 100
                 blocking: false
@@ -583,6 +609,7 @@ tiers:
 
             -
                 case_name: vyos_vrouter
+                enabled: false
                 project_name: functest
                 criteria: 100
                 blocking: false
index e1939c3..12562f0 100644 (file)
@@ -47,12 +47,15 @@ class TierBuilder(object):
                 dep = th.Dependency(installer, scenario)
 
                 testcase = th.TestCase(name=dic_testcase['case_name'],
+                                       enabled=dic_testcase.get(
+                                           'enabled', True),
                                        dependency=dep,
                                        criteria=dic_testcase['criteria'],
                                        blocking=dic_testcase['blocking'],
                                        clean_flag=dic_testcase['clean_flag'],
                                        description=dic_testcase['description'])
-                if testcase.is_compatible(self.ci_installer, self.ci_scenario):
+                if (testcase.is_compatible(self.ci_installer, self.ci_scenario)
+                        and testcase.is_enabled()):
                     tier.add_test(testcase)
 
             self.tier_objects.append(tier)
index fe7372a..36ce245 100644 (file)
@@ -105,12 +105,14 @@ class Tier(object):
 class TestCase(object):
 
     def __init__(self, name,
+                 enabled,
                  dependency,
                  criteria,
                  blocking,
                  clean_flag,
                  description=""):
         self.name = name
+        self.enabled = enabled
         self.dependency = dependency
         self.criteria = criteria
         self.blocking = blocking
@@ -138,6 +140,9 @@ class TestCase(object):
     def get_name(self):
         return self.name
 
+    def is_enabled(self):
+        return self.enabled
+
     def get_criteria(self):
         return self.criteria
 
index 1c09149..feaf33a 100644 (file)
@@ -22,6 +22,7 @@ class TierBuilderTesting(unittest.TestCase):
                            'scenario': 'test_scenario'}
 
         self.testcase = {'dependencies': self.dependency,
+                         'enabled': 'true',
                          'case_name': 'test_name',
                          'criteria': 'test_criteria',
                          'blocking': 'test_blocking',
index 21df409..2800627 100644 (file)
@@ -32,6 +32,7 @@ class TierHandlerTesting(unittest.TestCase):
                                       'test_ci_loop',
                                       description='test_desc')
         self.testcase = tier_handler.TestCase('test_name',
+                                              'true',
                                               self.mock_depend,
                                               'test_criteria',
                                               'test_blocking',
@@ -116,6 +117,10 @@ class TierHandlerTesting(unittest.TestCase):
         self.assertEqual(self.tier.get_name(),
                          'test_tier')
 
+    def test_testcase_is_enabled(self):
+        self.assertEqual(self.testcase.is_enabled(),
+                         'true')
+
     def test_testcase_get_criteria(self):
         self.assertEqual(self.tier.get_order(),
                          'test_order')