Merge lp:~sbaldassin/qakit/bileto_qakit into lp:qakit

Proposed by Santiago Baldassin
Status: Approved
Approved by: Sergio Cazzolato
Approved revision: 197
Proposed branch: lp:~sbaldassin/qakit/bileto_qakit
Merge into: lp:qakit
Diff against target: 79 lines (+28/-23)
2 files modified
qakit/practitest/practitest.py (+6/-2)
qakit/ust/worker.py (+22/-21)
To merge this branch: bzr merge lp:~sbaldassin/qakit/bileto_qakit
Reviewer Review Type Date Requested Status
Canonical Platform QA Team Pending
Review via email: mp+307565@code.launchpad.net

Commit message

Avoid the ust run if it was already triggered and return a default filter

Description of the change

This change prevents the ust run if it was already triggered and it also returns a default filter for those cases where the source package mapping was not added to the domains.json

To post a comment you must log in.

Unmerged revisions

197. By Santiago Baldassin

Minor changes

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'qakit/practitest/practitest.py'
--- qakit/practitest/practitest.py 2016-09-15 18:35:45 +0000
+++ qakit/practitest/practitest.py 2016-10-04 13:03:19 +0000
@@ -27,7 +27,7 @@
27from qakit.practitest import auth27from qakit.practitest import auth
28from qakit.practitest import util28from qakit.practitest import util
2929
3030DEFAULT_FILTER_LIST = ["126288"]
31PROD_PRACTITEST = 'https://prod.practitest.com/api'31PROD_PRACTITEST = 'https://prod.practitest.com/api'
3232
33TEST_LEVEL = '___f_10490'33TEST_LEVEL = '___f_10490'
@@ -399,7 +399,11 @@
399 domains_file = os.path.join(practitest_dir, 'data', 'domains.json')399 domains_file = os.path.join(practitest_dir, 'data', 'domains.json')
400 with open(domains_file) as domains:400 with open(domains_file) as domains:
401 domains_json = json.loads(domains.read())401 domains_json = json.loads(domains.read())
402 filters = [domains_json[package] for package in src_pkgs]402 try:
403 filters = [domains_json[package] for package in src_pkgs]
404 except KeyError:
405 return DEFAULT_FILTER_LIST
403406
404 # Flat the lists and remove duplicates407 # Flat the lists and remove duplicates
405 return list(set([item for sublist in filters for item in sublist]))408 return list(set([item for sublist in filters for item in sublist]))
409
406410
=== modified file 'qakit/ust/worker.py'
--- qakit/ust/worker.py 2016-09-15 19:32:05 +0000
+++ qakit/ust/worker.py 2016-10-04 13:03:19 +0000
@@ -62,27 +62,28 @@
62 is published in such a topic, it will be process by the62 is published in such a topic, it will be process by the
63 process_ust_request method which will call this one to run the tests63 process_ust_request method which will call this one to run the tests
64 """64 """
65 team, ppa_name = ppa.split('/')65 if self.get_result(ppa) is None:
66 launchpad_ppa = Ppa(team=team, name=ppa_name)66 team, ppa_name = ppa.split('/')
67 src_pkgs = launchpad_ppa.get_source_packages()67 launchpad_ppa = Ppa(team=team, name=ppa_name)
68 packages = list(68 src_pkgs = launchpad_ppa.get_source_packages()
69 set([package.source_package_name for package in src_pkgs]))69 packages = list(
70 request_id = launchpad_ppa.calculate_hash()70 set([package.source_package_name for package in src_pkgs]))
7171 request_id = launchpad_ppa.calculate_hash()
72 pt = PractitestSession(self.conf.parser.get('practitest', 'project_id'),72
73 self.conf.parser.get('practitest', 'api_key'),73 pt = PractitestSession(self.conf.parser.get('practitest', 'project_id'),
74 self.conf.parser.get('practitest', 'api_secret_key'))74 self.conf.parser.get('practitest', 'api_key'),
75 filters = pt.get_filters_for_src_pkgs(packages)75 self.conf.parser.get('practitest', 'api_secret_key'))
76 tests = pt.get_tests(filters)76 filters = pt.get_filters_for_src_pkgs(packages)
7777 tests = pt.get_tests(filters)
78 try:78
79 tests_ids = ' '.join([test['___f_10589']['value'] for test in tests])79 try:
80 except KeyError:80 tests_ids = ' '.join([test['___f_10589']['value'] for test in tests])
81 tests_ids = ' '81 except KeyError:
8282 tests_ids = ' '
83 self.jenkins.build_job(self.conf.parser.get('jenkins', 'job_name'),83
84 {"PPA": ppa, "TESTS_TO_RUN": tests_ids, "REQUEST_ID": request_id},84 self.jenkins.build_job(self.conf.parser.get('jenkins', 'job_name'),
85 {'token': self.conf.parser.get('jenkins', 'token')})85 {"PPA": ppa, "TESTS_TO_RUN": tests_ids, "REQUEST_ID": request_id},
86 {'token': self.conf.parser.get('jenkins', 'token')})
8687
87 def get_result(self, ppa):88 def get_result(self, ppa):
88 """89 """

Subscribers

People subscribed via source and target branches