Merge ~twom/launchpad:oci-show-cancelled-builds-correctly into launchpad:master

Proposed by Tom Wardill
Status: Merged
Approved by: Tom Wardill
Approved revision: 1118e9fda5545306cfd189064dcfa7a67264b61c
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~twom/launchpad:oci-show-cancelled-builds-correctly
Merge into: launchpad:master
Diff against target: 75 lines (+52/-1)
2 files modified
lib/lp/oci/browser/tests/test_ocirecipe.py (+50/-0)
lib/lp/oci/model/ocirecipe.py (+2/-1)
Reviewer Review Type Date Requested Status
Colin Watson Approve
Review via email: mp+407096@code.launchpad.net

Commit message

Show CANCELLING builds as a failed Set correctly.

To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/lib/lp/oci/browser/tests/test_ocirecipe.py b/lib/lp/oci/browser/tests/test_ocirecipe.py
index 408c032..4a36517 100644
--- a/lib/lp/oci/browser/tests/test_ocirecipe.py
+++ b/lib/lp/oci/browser/tests/test_ocirecipe.py
@@ -1442,6 +1442,56 @@ class TestOCIRecipeView(BaseTestOCIRecipeView):
1442 "This OCI recipe contains Public information",1442 "This OCI recipe contains Public information",
1443 extract_text(privacy_tag))1443 extract_text(privacy_tag))
14441444
1445 def test_index_cancelling_build(self):
1446 oci_project = self.factory.makeOCIProject(
1447 pillar=self.distroseries.distribution)
1448 [ref] = self.factory.makeGitRefs(
1449 owner=self.person, target=self.person, name="recipe-repository",
1450 paths=["refs/heads/v1.0-20.04"])
1451 recipe = self.makeRecipe(
1452 processor_names=["amd64", "386"],
1453 build_file="Dockerfile", git_ref=ref,
1454 oci_project=oci_project, registrant=self.person, owner=self.person)
1455 build_request = recipe.requestBuilds(self.person)
1456 builds = recipe.requestBuildsFromJob(self.person, build_request)
1457 job = removeSecurityProxy(build_request).job
1458 removeSecurityProxy(job).builds = builds
1459
1460 for build in builds:
1461 removeSecurityProxy(build).updateStatus(
1462 BuildStatus.BUILDING, builder=None,
1463 date_started=build.date_created)
1464 removeSecurityProxy(build).updateStatus(
1465 BuildStatus.CANCELLING, builder=None,
1466 date_finished=build.date_started + timedelta(minutes=30))
1467
1468 browser = self.getViewBrowser(build_request.recipe)
1469 login_person(self.person)
1470 self.assertTextMatchesExpressionIgnoreWhitespace("""\
1471 .*
1472 There were build failures.
1473 No registry upload requested.
1474 a moment ago
1475 in 30 minutes
1476 \\(estimated\\)
1477 amd64
1478 Cancelling build
1479 386
1480 Cancelling build
1481 amd64
1482 386
1483 in 30 minutes
1484 \\(estimated\\)
1485 .*
1486 """,
1487 extract_text(find_main_content(browser.contents)))
1488
1489 # Check portlet on side menu.
1490 privacy_tag = find_tag_by_id(browser.contents, "privacy")
1491 self.assertTextMatchesExpressionIgnoreWhitespace(
1492 "This OCI recipe contains Public information",
1493 extract_text(privacy_tag))
1494
1445 def test_index_for_private_recipe_shows_banner(self):1495 def test_index_for_private_recipe_shows_banner(self):
1446 recipe = self.factory.makeOCIRecipe(1496 recipe = self.factory.makeOCIRecipe(
1447 registrant=self.person, owner=self.person,1497 registrant=self.person, owner=self.person,
diff --git a/lib/lp/oci/model/ocirecipe.py b/lib/lp/oci/model/ocirecipe.py
index 5e491a7..392455a 100644
--- a/lib/lp/oci/model/ocirecipe.py
+++ b/lib/lp/oci/model/ocirecipe.py
@@ -972,7 +972,8 @@ class OCIRecipeSet:
972 building = collect_builds(BuildStatus.BUILDING,972 building = collect_builds(BuildStatus.BUILDING,
973 BuildStatus.UPLOADING)973 BuildStatus.UPLOADING)
974 successful = collect_builds(BuildStatus.FULLYBUILT)974 successful = collect_builds(BuildStatus.FULLYBUILT)
975 cancelled = collect_builds(BuildStatus.CANCELLED)975 cancelled = collect_builds(BuildStatus.CANCELLING,
976 BuildStatus.CANCELLED)
976977
977 # Note: the BuildStatus DBItems are used here to summarize the978 # Note: the BuildStatus DBItems are used here to summarize the
978 # status of a set of builds:s979 # status of a set of builds:s

Subscribers

People subscribed via source and target branches

to status/vote changes: