[PATCH 14/20] oeqa.selftest.prservice: Split configuration from code

Jose Lamego
2016-08-08T16:23:22Z

meta/lib/oeqa/selftest/conf/prservice.conf | 21 +++++++++
meta/lib/oeqa/selftest/prservice.py | 71 ++++++++++++++++++++++++++----
2 files changed, 83 insertions(+), 9 deletions(-)
create mode 100644 meta/lib/oeqa/selftest/conf/prservice.conf

diff --git a/meta/lib/oeqa/selftest/conf/prservice.conf b/meta/lib/oeqa/selftest/conf/prservice.conf
new file mode 100644
index 0000000..2d5f315
--- /dev/null
+++ b/meta/lib/oeqa/selftest/conf/prservice.conf
@@ -0,0 +1,21 @@
+[BitbakePrTests]
+import_export_replace_db_package = m4
+import_export_override_db_package = m4
+pr_service_rpm_arch_dep_package = m4
+pr_service_rpm_arch_dep_package_type = rpm
+pr_service_rpm_arch_dep_track_task = do_package
+pr_service_deb_arch_dep_package = m4
+pr_service_deb_arch_dep_package_type = deb
+pr_service_deb_arch_dep_track_task = do_package
+pr_service_ipk_arch_dep_package = m4
+pr_service_ipk_arch_dep_package_type = ipk
+pr_service_ipk_arch_dep_track_task = do_package
+pr_service_rpm_arch_indep_package = xcursor-transparent-theme
+pr_service_rpm_arch_indep_package_type = rpm
+pr_service_rpm_arch_indep_track_task = do_package
+pr_service_deb_arch_indep_package = xcursor-transparent-theme
+pr_service_deb_arch_indep_package_type = deb
+pr_service_deb_arch_indep_track_task = do_package
+pr_service_ipk_arch_indep_package = xcursor-transparent-theme
+pr_service_ipk_arch_indep_package_type = ipk
+pr_service_ipk_arch_indep_track_task = do_package
diff --git a/meta/lib/oeqa/selftest/prservice.py b/meta/lib/oeqa/selftest/prservice.py
index 1b9a510..af8ffec 100644
--- a/meta/lib/oeqa/selftest/prservice.py
+++ b/meta/lib/oeqa/selftest/prservice.py
@@ -10,9 +10,16 @@ from oeqa.selftest.base import oeSelfTest
from oeqa.utils.commands import runCmd, bitbake, get_bb_var
from oeqa.utils.decorators import testcase
from oeqa.utils.network import get_free_port
+from oeqa.utils.readconfig import conffile
+

class BitbakePrTests(oeSelfTest):
-
+
+ @classmethod
+ def setUpClass(cls):
+ # Get test configurations from configuration file
+ cls.config = conffile(__file__)
+
def get_pr_version(self, package_name):
pkgdata_dir = get_bb_var('PKGDATA_DIR')
package_data_file = os.path.join(pkgdata_dir, 'runtime', package_name)
@@ -91,35 +98,81 @@ class BitbakePrTests(oeSelfTest):

@testcase(930)
def test_import_export_replace_db(self):
- self.run_test_pr_export_import('m4')
+ package = self.config.get(
+ 'BitbakePrTests', 'import_export_replace_db_package')
+ self.run_test_pr_export_import(package)

@testcase(931)
def test_import_export_override_db(self):
- self.run_test_pr_export_import('m4', replace_current_db=False)
+ package = self.config.get(
+ 'BitbakePrTests', 'import_export_override_db_package')
+ self.run_test_pr_export_import(package, replace_current_db=False)

@testcase(932)
def test_pr_service_rpm_arch_dep(self):
- self.run_test_pr_service('m4', 'rpm', 'do_package')
+ # Test configuration is taken from conf file
+ package = self.config.get(
+ 'BitbakePrTests', 'pr_service_rpm_arch_dep_package')
+ package_type = self.config.get(
+ 'BitbakePrTests', 'pr_service_rpm_arch_dep_package_type')
+ track_task = self.config.get(
+ 'BitbakePrTests', 'pr_service_rpm_arch_dep_track_task')
+ self.run_test_pr_service(package, package_type, track_task)

@testcase(934)
def test_pr_service_deb_arch_dep(self):
- self.run_test_pr_service('m4', 'deb', 'do_package')
+ # Get test configurations from configuration file
+ package = self.config.get(
+ 'BitbakePrTests', 'pr_service_deb_arch_dep_package')
+ package_type = self.config.get(
+ 'BitbakePrTests', 'pr_service_deb_arch_dep_package_type')
+ track_task = self.config.get(
+ 'BitbakePrTests', 'pr_service_deb_arch_dep_track_task')
+ self.run_test_pr_service(package, package_type, track_task)

@testcase(933)
def test_pr_service_ipk_arch_dep(self):
- self.run_test_pr_service('m4', 'ipk', 'do_package')
+ # Get test configurations from configuration file
+ package = self.config.get(
+ 'BitbakePrTests', 'pr_service_ipk_arch_dep_package')
+ package_type = self.config.get(
+ 'BitbakePrTests', 'pr_service_ipk_arch_dep_package_type')
+ track_task = self.config.get(
+ 'BitbakePrTests', 'pr_service_ipk_arch_dep_track_task')
+ self.run_test_pr_service(package, package_type, track_task)

@testcase(935)
def test_pr_service_rpm_arch_indep(self):
- self.run_test_pr_service('xcursor-transparent-theme', 'rpm', 'do_package')
+ # Get test configurations from configuration file
+ package = self.config.get(
+ 'BitbakePrTests', 'pr_service_rpm_arch_indep_package')
+ package_type = self.config.get(
+ 'BitbakePrTests', 'pr_service_rpm_arch_indep_package_type')
+ track_task = self.config.get(
+ 'BitbakePrTests', 'pr_service_rpm_arch_indep_track_task')
+ self.run_test_pr_service(package, package_type, track_task)

@testcase(937)
def test_pr_service_deb_arch_indep(self):
- self.run_test_pr_service('xcursor-transparent-theme', 'deb', 'do_package')
+ # Get test configurations from configuration file
+ package = self.config.get(
+ 'BitbakePrTests', 'pr_service_deb_arch_indep_package')
+ package_type = self.config.get(
+ 'BitbakePrTests', 'pr_service_deb_arch_indep_package_type')
+ track_task = self.config.get(
+ 'BitbakePrTests', 'pr_service_deb_arch_indep_track_task')
+ self.run_test_pr_service(package, package_type, track_task)

@testcase(936)
def test_pr_service_ipk_arch_indep(self):
- self.run_test_pr_service('xcursor-transparent-theme', 'ipk', 'do_package')
+ # Get test configurations from configuration file
+ package = self.config.get(
+ 'BitbakePrTests', 'pr_service_ipk_arch_indep_package')
+ package_type = self.config.get(
+ 'BitbakePrTests', 'pr_service_ipk_arch_indep_package_type')
+ track_task = self.config.get(
+ 'BitbakePrTests', 'pr_service_ipk_arch_indep_track_task')
+ self.run_test_pr_service(package, package_type, track_task)

@testcase(1419)
def test_stopping_prservice_message(self):
--
1.8.3.1