aboutsummaryrefslogtreecommitdiffstats
path: root/ci
diff options
context:
space:
mode:
authorjose.lausuch <jose.lausuch@ericsson.com>2016-05-10 11:51:18 +0000
committerGerrit Code Review <gerrit@172.30.200.206>2016-05-10 11:51:18 +0000
commitacd3d80504a56183a4909dce52b56bc7e15bc6cd (patch)
tree9c656eb5db5813865537cb1f0693564dbc38e32b /ci
parent7eeab2d73796b1054c20b41329835adc090bbf3c (diff)
parentbd00e6f289a69badf7beea827b20764ed3252c7a (diff)
Merge "CLI implementation"
Diffstat (limited to 'ci')
-rw-r--r--ci/prepare_env.py2
-rw-r--r--ci/testcases.yaml4
-rw-r--r--ci/tier_builder.py6
-rw-r--r--ci/tier_handler.py95
4 files changed, 52 insertions, 55 deletions
diff --git a/ci/prepare_env.py b/ci/prepare_env.py
index 1a3d495cf..61740cd2e 100644
--- a/ci/prepare_env.py
+++ b/ci/prepare_env.py
@@ -268,7 +268,7 @@ def main():
sys.exit()
if args.action == "start":
- logger.info("\n######### Preparing Functest environment #########\n")
+ logger.info("######### Preparing Functest environment #########\n")
check_env_variables()
create_directories()
source_rc_file()
diff --git a/ci/testcases.yaml b/ci/testcases.yaml
index 51c43fcb1..7f701d1a3 100644
--- a/ci/testcases.yaml
+++ b/ci/testcases.yaml
@@ -135,7 +135,7 @@ tiers:
scenario: ''
-
- name: sdnvpn
+ name: bgpvpn
description: >-
Test suite from SDNVPN project.
dependencies:
@@ -153,7 +153,7 @@ tiers:
name: tempest
description: >-
The list of test cases is generated by
- Tempest automatically and depend on the parameters of
+ Tempest automatically and depends on the parameters of
the OpenStack deplopyment.
dependencies:
installer: ''
diff --git a/ci/tier_builder.py b/ci/tier_builder.py
index 82b58cd03..05bcc8f33 100644
--- a/ci/tier_builder.py
+++ b/ci/tier_builder.py
@@ -57,6 +57,12 @@ class TierBuilder:
def get_tiers(self):
return self.tier_objects
+ def get_tier_names(self):
+ tier_names = []
+ for tier in self.tier_objects:
+ tier_names.append(tier.get_name())
+ return tier_names
+
def get_tier(self, tier_name):
for i in range(0, len(self.tier_objects)):
if self.tier_objects[i].get_name() == tier_name:
diff --git a/ci/tier_handler.py b/ci/tier_handler.py
index 9b444b7ca..af6345f06 100644
--- a/ci/tier_handler.py
+++ b/ci/tier_handler.py
@@ -10,6 +10,23 @@
import re
+LINE_LENGTH = 72
+
+
+def split_text(text, max_len):
+ words = text.split()
+ lines = []
+ line = ""
+ for word in words:
+ if len(line) + len(word) < max_len - 1:
+ line += word + " "
+ else:
+ lines.append(line)
+ line = word + " "
+ if line != "":
+ lines.append(line)
+ return lines
+
class Tier:
def __init__(self, name, order, ci, description=""):
@@ -54,41 +71,28 @@ class Tier:
return self.order
def __str__(self):
- lines = []
- line_max = 50
- line = ""
- line_count = 0
- for i in range(len(self.description)):
- line += self.description[i]
- if line_count >= line_max - 1:
- line_count = 0
- lines.append(line)
- line = ""
- else:
- line_count += 1
- if line != "":
- lines.append(line)
+ lines = split_text(self.description, LINE_LENGTH-6)
out = ""
- out += ("+=======================================================+\n")
- out += ("| Tier: " + self.name.ljust(47) + "|\n")
- out += ("+=======================================================+\n")
- out += ("| Order: " + str(self.order).ljust(47) + "|\n")
- out += ("| Description: |\n")
- for i in range(len(lines)):
- out += ("| " + lines[i].ljust(50) + " |\n")
- out += ("| Test cases: |\n")
+ out += ("+%s+\n" % ("=" * (LINE_LENGTH - 2)))
+ 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 += ("| Description:".ljust(LINE_LENGTH - 1) + "|\n")
+ for line in lines:
+ out += ("| " + line.ljust(LINE_LENGTH - 7) + " |\n")
+ out += ("| Test cases:".ljust(LINE_LENGTH - 1) + "|\n")
tests = self.get_test_names()
if len(tests) > 0:
for i in range(len(tests)):
- out += ("| - %s |\n" % tests[i].ljust(48))
+ out += ("| - %s |\n" % tests[i].ljust(LINE_LENGTH - 9))
else:
out += ("| (There are no supported test cases "
- .ljust(56) + "|\n")
+ .ljust(LINE_LENGTH - 1) + "|\n")
out += ("| in this tier for the given scenario) "
- .ljust(56) + "|\n")
- out += ("|".ljust(56) + "|\n")
- out += ("+-------------------------------------------------------+\n")
+ .ljust(LINE_LENGTH - 1) + "|\n")
+ out += ("|".ljust(LINE_LENGTH - 1) + "|\n")
+ out += ("+%s+\n" % ("-" * (LINE_LENGTH - 2)))
return out
@@ -111,35 +115,22 @@ class TestCase:
return self.name
def __str__(self):
- lines = []
- line_max = 50
- line = ""
- line_count = 0
- for i in range(len(self.description)):
- line += self.description[i]
- if line_count >= line_max - 1:
- line_count = 0
- lines.append(line)
- line = ""
- else:
- line_count += 1
- if line != "":
- lines.append(line)
+ lines = split_text(self.description, LINE_LENGTH-6)
out = ""
- out += ("+=======================================================+\n")
- out += ("| Testcase: " + self.name.ljust(43) + "|\n")
- out += ("+=======================================================+\n")
- out += ("| Description: |\n")
- for i in range(len(lines)):
- out += ("| " + lines[i].ljust(50) + " |\n")
- out += ("| Dependencies: |\n")
+ out += ("+%s+\n" % ("=" * (LINE_LENGTH - 2)))
+ out += ("| Testcase: " + self.name.ljust(LINE_LENGTH - 14) + "|\n")
+ out += ("+%s+\n" % ("=" * (LINE_LENGTH - 2)))
+ out += ("| Description:".ljust(LINE_LENGTH - 1) + "|\n")
+ for line in lines:
+ out += ("| " + line.ljust(LINE_LENGTH - 7) + " |\n")
+ out += ("| Dependencies:".ljust(LINE_LENGTH - 1) + "|\n")
installer = self.dependency.get_installer()
scenario = self.dependency.get_scenario()
- out += ("| - Installer: " + installer.ljust(38) + "|\n")
- out += ("| - Scenario : " + scenario.ljust(38) + "|\n")
- out += ("|".ljust(56) + "|\n")
- out += ("+-------------------------------------------------------+\n")
+ out += ("| - Installer:" + installer.ljust(LINE_LENGTH - 17) + "|\n")
+ out += ("| - Scenario :" + scenario.ljust(LINE_LENGTH - 17) + "|\n")
+ out += ("|".ljust(LINE_LENGTH - 1) + "|\n")
+ out += ("+%s+\n" % ("-" * (LINE_LENGTH - 2)))
return out