Adapt tiers to run depending on WEEKLY/DAILY
authorjose.lausuch <jose.lausuch@ericsson.com>
Mon, 9 May 2016 13:08:41 +0000 (15:08 +0200)
committerjose.lausuch <jose.lausuch@ericsson.com>
Tue, 10 May 2016 12:13:43 +0000 (14:13 +0200)
JIRA: FUNCTEST-244

Change-Id: I11bf28baff52b75b0f6c58845edc22f266dfcbe8
Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
ci/run_tests.py
ci/testcases.yaml
ci/tier_builder.py
ci/tier_handler.py
cli/cli_base.py

index f30e7b9..5dba181 100644 (file)
@@ -10,6 +10,7 @@
 
 import argparse
 import os
+import re
 import sys
 
 import functest.ci.tier_builder as tb
@@ -101,15 +102,25 @@ def run_tier(tier):
 
 def run_all(tiers):
     summary = ""
+    BUILD_TAG = os.getenv('BUILD_TAG')
+    if BUILD_TAG is not None and re.search("daily", BUILD_TAG) is not None:
+        CI_LOOP = "daily"
+    else:
+        CI_LOOP = "weekly"
+
+    tiers_to_run = []
+
     for tier in tiers.get_tiers():
-        summary += ("\n    - %s. %s:\n\t   %s"
-                    % (tier.get_order(),
-                       tier.get_name(),
-                       tier.get_test_names()))
+        if re.search(CI_LOOP, tier.get_ci_loop()) is not None:
+            tiers_to_run.append(tier)
+            summary += ("\n    - %s. %s:\n\t   %s"
+                        % (tier.get_order(),
+                           tier.get_name(),
+                           tier.get_test_names()))
 
     logger.info("Tiers to be executed:%s" % summary)
 
-    for tier in tiers.get_tiers():
+    for tier in tiers_to_run:
         run_tier(tier)
 
 
index 7f701d1..0450681 100644 (file)
@@ -2,7 +2,7 @@ tiers:
     -
         name: healthcheck
         order: 0
-        ci: daily
+        ci_loop: '(daily)|(weekly)'
         description : >-
             First tier to be executed to verify the basic
             operations in the VIM.
@@ -20,15 +20,15 @@ tiers:
     -
         name: smoke
         order: 1
-        ci: daily
+        ci_loop: '(daily)|(weekly)'
         description : >-
             Set of basic Functional tests to validate the OpenStack deployment.
         testcases:
             -
                 name: vping_ssh
                 description: >-
-                    This test case verifies: 1) SSH to an instance using floating 
-                    IPs over the public network. 2) Connectivity between 2 instances 
+                    This test case verifies: 1) SSH to an instance using floating
+                    IPs over the public network. 2) Connectivity between 2 instances
                     over a private network.
                 dependencies:
                     installer: ''
@@ -37,7 +37,7 @@ tiers:
             -
                 name: vping_userdata
                 description: >-
-                    This test case verifies:  1) Boot a VM with given userdata. 
+                    This test case verifies:  1) Boot a VM with given userdata.
                     2) Connectivity between 2 instances over a private network.
                 dependencies:
                     installer: ''
@@ -76,7 +76,7 @@ tiers:
     -
         name: sdn_suites
         order: 2
-        ci: daily
+        ci_loop: '(daily)|(weekly)'
         description : >-
             Test suites corresponding to the different
             SDN Controllers existing in OPNFV.
@@ -113,7 +113,7 @@ tiers:
     -
         name: features
         order: 3
-        ci: daily
+        ci_loop: '(daily)|(weekly)'
         description : >-
             Test suites from feature projects
             integrated in functest
@@ -145,7 +145,7 @@ tiers:
     -
         name: tempest
         order: 4
-        ci: weekly
+        ci_loop: 'weekly'
         description : >-
             This test case runs the full set of the OpenStack Tempest suite.
         testcases:
@@ -162,7 +162,7 @@ tiers:
     -
         name: rally
         order: 5
-        ci: weekly
+        ci_loop: 'weekly'
         description : >-
             Rally suite from the OpenStack community.
         testcases:
@@ -178,7 +178,7 @@ tiers:
     -
         name: vnf
         order: 6
-        ci: weekly
+        ci_loop: 'weekly'
         description : >-
             Collection of VNF test cases.
         testcases:
index 05bcc8f..4723bf4 100644 (file)
@@ -38,7 +38,7 @@ class TierBuilder:
         for dic_tier in self.dic_tier_array:
             tier = th.Tier(name=dic_tier['name'],
                            order=dic_tier['order'],
-                           ci=dic_tier['ci'],
+                           ci_loop=dic_tier['ci_loop'],
                            description=dic_tier['description'])
 
             for dic_testcase in dic_tier['testcases']:
index af6345f..dd0d10c 100644 (file)
@@ -29,11 +29,11 @@ def split_text(text, max_len):
 
 
 class Tier:
-    def __init__(self, name, order, ci, description=""):
+    def __init__(self, name, order, ci_loop, description=""):
         self.tests_array = []
         self.name = name
         self.order = order
-        self.ci = ci
+        self.ci_loop = ci_loop
         self.description = description
 
     def add_test(self, testcase):
@@ -70,6 +70,9 @@ class Tier:
     def get_order(self):
         return self.order
 
+    def get_ci_loop(self):
+        return self.ci_loop
+
     def __str__(self):
         lines = split_text(self.description, LINE_LENGTH-6)
 
@@ -78,6 +81,8 @@ class Tier:
         out += ("| Tier:  " + self.name.ljust(LINE_LENGTH - 10) + "|\n")
         out += ("+%s+\n" % ("=" * (LINE_LENGTH - 2)))
         out += ("| Order: " + str(self.order).ljust(LINE_LENGTH - 10) + "|\n")
+        out += ("| CI Loop: " + str(self.ci_loop).ljust(LINE_LENGTH - 12) +
+                "|\n")
         out += ("| Description:".ljust(LINE_LENGTH - 1) + "|\n")
         for line in lines:
             out += ("|    " + line.ljust(LINE_LENGTH - 7) + " |\n")
index 25696db..583b0ab 100644 (file)
@@ -82,7 +82,7 @@ def os_show_credentials():
 
 
 @openstack.command('fetch-rc', help="Fetch the OpenStack RC file from "
-                   "the installer")
+                   "the installer.")
 def os_fetch_rc():
     _openstack.fetch_credentials()