This repository has been archived by the owner on Dec 15, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
various selective testing UI improvement
Summary: This diff contains the following: - show selective testing policy for a build in the build info page - separate out recreate button into the regular recreate and recrate with selective testing - display result source in the targets UI Only autobazel projects should be affected. Test Plan: ran locally, unit tests {F528893} {F529914} Reviewers: anupc Reviewed By: anupc Subscribers: changesbot, wwu, kylec, anupc Tags: #changes_ui Differential Revision: https://tails.corp.dropbox.com/D232658
- Loading branch information
Naphat Sanguansin
committed
Sep 29, 2016
1 parent
842343b
commit e9ef7e7
Showing
14 changed files
with
234 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from sqlalchemy import literal | ||
from changes.config import db | ||
from changes.models.build import Build # NOQA | ||
from changes.models.jobplan import JobPlan | ||
from changes.models.option import ItemOption | ||
|
||
|
||
def contains_autogenerated_plan(build): | ||
"""Returns true if any of the jobs in this build was created with an | ||
autogenerated jobplan. | ||
""" | ||
# type: (Build)->bool | ||
contains = db.session.query(literal(True)).filter( | ||
ItemOption.query.join( | ||
JobPlan, JobPlan.plan_id == ItemOption.item_id, | ||
).filter( | ||
ItemOption.name == 'bazel.autogenerate', | ||
ItemOption.value == '1', | ||
JobPlan.build_id == build.id, | ||
).exists() | ||
).scalar() | ||
return bool(contains) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
from __future__ import absolute_import | ||
|
||
from changes.lib import build_lib | ||
from changes.models.plan import PlanStatus | ||
from changes.testutils import TestCase | ||
|
||
|
||
class AutogeneratedJobplansTestCase(TestCase): | ||
def test_false(self): | ||
build = self.create_build(self.create_project()) | ||
assert not build_lib.contains_autogenerated_plan(build) | ||
|
||
def test_false_value(self): | ||
project = self.create_project() | ||
plan = self.create_plan(project) | ||
self.create_option(item_id=plan.id, name='bazel.autogenerate', value='0') | ||
build = self.create_build(project) | ||
job = self.create_job(build) | ||
jobplan = self.create_job_plan(job, plan) | ||
assert not build_lib.contains_autogenerated_plan(build) | ||
|
||
def test_true(self): | ||
project = self.create_project() | ||
plan = self.create_plan(project) | ||
self.create_option(item_id=plan.id, name='bazel.autogenerate', value='1') | ||
build = self.create_build(project) | ||
job = self.create_job(build) | ||
jobplan = self.create_job_plan(job, plan) | ||
assert build_lib.contains_autogenerated_plan(build) | ||
|
||
def test_true_multiple(self): | ||
project = self.create_project() | ||
plan = self.create_plan(project, status=PlanStatus.active) | ||
self.create_option(item_id=plan.id, name='bazel.autogenerate', value='0') | ||
build = self.create_build(project) | ||
job = self.create_job(build) | ||
jobplan = self.create_job_plan(job, plan) | ||
plan = self.create_plan(project, status=PlanStatus.active) | ||
self.create_option(item_id=plan.id, name='bazel.autogenerate', value='1') | ||
build = self.create_build(project) | ||
job = self.create_job(build) | ||
jobplan = self.create_job_plan(job, plan) | ||
assert build_lib.contains_autogenerated_plan(build) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.