aboutsummaryrefslogtreecommitdiffstats
path: root/ci/tier_handler.py
diff options
context:
space:
mode:
authorjose.lausuch <jose.lausuch@ericsson.com>2016-04-25 18:08:22 +0200
committerjose.lausuch <jose.lausuch@ericsson.com>2016-04-27 15:34:56 +0200
commit9c13968cdb32806da738dc520d45270e019f0ad3 (patch)
tree50eb0e0889dc72a1ce4dec0da60607c834d91fc0 /ci/tier_handler.py
parent790fa04f4503dbf60123bf9414db131580f2c45a (diff)
Create prepare_env.py from prepare_env.sh and config_functest.py
JIRA: FUNCTEST-227 Change-Id: I1aa890b9f91ec524c766ba3c460666ed227f2126 Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
Diffstat (limited to 'ci/tier_handler.py')
-rw-r--r--ci/tier_handler.py75
1 files changed, 75 insertions, 0 deletions
diff --git a/ci/tier_handler.py b/ci/tier_handler.py
new file mode 100644
index 00000000..0b755949
--- /dev/null
+++ b/ci/tier_handler.py
@@ -0,0 +1,75 @@
+#!/usr/bin/env python
+#
+# jose.lausuch@ericsson.com
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+
+
+import re
+
+
+class Tier:
+ def __init__(self, name, order, ci, description=""):
+ self.tests_array = []
+ self.name = name
+ self.order = order
+ self.ci = ci
+ self.description = description
+
+ def add_test(self, testcase):
+ self.tests_array.append(testcase)
+
+ def get_tests(self):
+ array_str = []
+ for test in self.tests_array:
+ array_str.append(test.name)
+ return array_str
+
+ def __str__(self):
+ return ("Tier info:\n"
+ " Name: " + self.name + "\n"
+ " Description: " + self.description + "\n"
+ " Order: " + str(self.order) + "\n"
+ " Test cases: " + str(self.get_tests()) + "\n")
+
+
+class TestCase:
+ def __init__(self, name, dependency, description=""):
+ self.name = name
+ self.dependency = dependency
+ self.description = description
+
+ def is_compatible(self, ci_installer, ci_scenario):
+ if re.search(self.dependency.get_installer(), ci_installer) is None:
+ return False
+
+ if re.search(self.dependency.get_scenario(), ci_scenario) is None:
+ return False
+
+ return True
+
+ def __str__(self):
+ return ("Testcase info:\n"
+ " Name: " + self.name + "\n"
+ " Description: " + self.description + "\n"
+ " " + str(self.dependency) + "\n")
+
+
+class Dependency:
+ def __init__(self, installer, scenario):
+ self.installer = installer
+ self.scenario = scenario
+
+ def get_installer(self):
+ return self.installer
+
+ def get_scenario(self):
+ return self.scenario
+
+ def __str__(self):
+ return ("Dependency info:\n"
+ " installer: " + self.installer + "\n"
+ " scenario: " + self.scenario + "\n")