← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:builder-constraints-not-None into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:builder-constraints-not-None into launchpad:master.

Commit message:
Don't dispatch builder_constraints as None

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/436245

launchpad-buildd 226 accidentally assumes that it's either absent or non-None, but it's probably a good idea to avoid sending None anyway.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:builder-constraints-not-None into launchpad:master.
diff --git a/lib/lp/buildmaster/interfaces/buildfarmjobbehaviour.py b/lib/lp/buildmaster/interfaces/buildfarmjobbehaviour.py
index 0ef7da0..d78d9ca 100644
--- a/lib/lp/buildmaster/interfaces/buildfarmjobbehaviour.py
+++ b/lib/lp/buildmaster/interfaces/buildfarmjobbehaviour.py
@@ -8,7 +8,7 @@ __all__ = [
     "IBuildFarmJobBehaviour",
 ]
 
-from typing import Any, Dict, Generator, List, Tuple, Union
+from typing import Any, Dict, Generator, List, Sequence, Union
 
 from typing_extensions import TypedDict
 from zope.interface import Attribute, Interface
@@ -72,7 +72,7 @@ BuildArgs = TypedDict(
         # The URL of this build.
         "build_url": str,
         # Builder resource tags required by this build farm job.
-        "builder_constraints": Tuple[str],
+        "builder_constraints": Sequence[str],
         # Source snap channels to use for this build [charm, ci, snap].
         "channels": Dict[str, str],
         # The date stamp to set in the built image [livefs].
diff --git a/lib/lp/buildmaster/model/buildfarmjobbehaviour.py b/lib/lp/buildmaster/model/buildfarmjobbehaviour.py
index 15b860e..f4218df 100644
--- a/lib/lp/buildmaster/model/buildfarmjobbehaviour.py
+++ b/lib/lp/buildmaster/model/buildfarmjobbehaviour.py
@@ -102,7 +102,7 @@ class BuildFarmJobBehaviourBase:
             "archive_private": self.archive.private,
             "build_url": canonical_url(self.build),
             "builder_constraints": removeSecurityProxy(
-                self.build.builder_constraints
+                self.build.builder_constraints or []
             ),
             "fast_cleanup": self._builder.virtualized,
             "series": self.distro_arch_series.distroseries.name,
diff --git a/lib/lp/charms/tests/test_charmrecipebuildbehaviour.py b/lib/lp/charms/tests/test_charmrecipebuildbehaviour.py
index 9f21dcf..10e676d 100644
--- a/lib/lp/charms/tests/test_charmrecipebuildbehaviour.py
+++ b/lib/lp/charms/tests/test_charmrecipebuildbehaviour.py
@@ -304,7 +304,7 @@ class TestAsyncCharmRecipeBuildBehaviour(
                     "archives": Equals(expected_archives),
                     "arch_tag": Equals("i386"),
                     "build_url": Equals(canonical_url(job.build)),
-                    "builder_constraints": Is(None),
+                    "builder_constraints": Equals([]),
                     "channels": Equals({}),
                     "fast_cleanup": Is(True),
                     "git_repository": Equals(ref.repository.git_https_url),
@@ -346,7 +346,7 @@ class TestAsyncCharmRecipeBuildBehaviour(
                     "archives": Equals(expected_archives),
                     "arch_tag": Equals("i386"),
                     "build_url": Equals(canonical_url(job.build)),
-                    "builder_constraints": Is(None),
+                    "builder_constraints": Equals([]),
                     "channels": Equals({}),
                     "fast_cleanup": Is(True),
                     "git_repository": Equals(ref.repository.git_https_url),
diff --git a/lib/lp/code/model/tests/test_cibuildbehaviour.py b/lib/lp/code/model/tests/test_cibuildbehaviour.py
index 52b3139..4d6221f 100644
--- a/lib/lp/code/model/tests/test_cibuildbehaviour.py
+++ b/lib/lp/code/model/tests/test_cibuildbehaviour.py
@@ -299,7 +299,7 @@ class TestAsyncCIBuildBehaviour(StatsMixin, TestCIBuildBehaviourBase):
                     "archives": Equals(expected_archives),
                     "arch_tag": Equals("i386"),
                     "build_url": Equals(canonical_url(job.build)),
-                    "builder_constraints": Is(None),
+                    "builder_constraints": Equals([]),
                     "fast_cleanup": Is(True),
                     "git_path": Equals(job.build.commit_sha1),
                     "git_repository": Equals(
@@ -435,7 +435,7 @@ class TestAsyncCIBuildBehaviour(StatsMixin, TestCIBuildBehaviourBase):
                     "archives": Equals(expected_archives),
                     "arch_tag": Equals("i386"),
                     "build_url": Equals(canonical_url(job.build)),
-                    "builder_constraints": Is(None),
+                    "builder_constraints": Equals([]),
                     "fast_cleanup": Is(True),
                     "git_path": Equals(job.build.commit_sha1),
                     "git_repository": Equals(
@@ -610,7 +610,7 @@ class TestAsyncCIBuildBehaviour(StatsMixin, TestCIBuildBehaviourBase):
                     "archives": Equals(expected_archives),
                     "arch_tag": Equals("i386"),
                     "build_url": Equals(canonical_url(job.build)),
-                    "builder_constraints": Is(None),
+                    "builder_constraints": Equals([]),
                     "fast_cleanup": Is(True),
                     "git_path": Equals(job.build.commit_sha1),
                     "git_repository": AfterPreprocessing(
diff --git a/lib/lp/code/model/tests/test_recipebuilder.py b/lib/lp/code/model/tests/test_recipebuilder.py
index 1fe01d9..ce34d6f 100644
--- a/lib/lp/code/model/tests/test_recipebuilder.py
+++ b/lib/lp/code/model/tests/test_recipebuilder.py
@@ -212,7 +212,7 @@ class TestAsyncRecipeBuilder(TestRecipeBuilderBase):
                 "author_email": "requester@xxxxxxxxxx",
                 "author_name": "Joe User",
                 "build_url": canonical_url(job.build),
-                "builder_constraints": None,
+                "builder_constraints": [],
                 "distroseries_name": job.build.distroseries.name,
                 "fast_cleanup": True,
                 "ogrecomponent": "universe",
@@ -315,7 +315,7 @@ class TestAsyncRecipeBuilder(TestRecipeBuilderBase):
                 "author_email": "requester@xxxxxxxxxx",
                 "author_name": "Joe User",
                 "build_url": canonical_url(job.build),
-                "builder_constraints": None,
+                "builder_constraints": [],
                 "distroseries_name": job.build.distroseries.name,
                 "fast_cleanup": True,
                 "ogrecomponent": "universe",
@@ -365,7 +365,7 @@ class TestAsyncRecipeBuilder(TestRecipeBuilderBase):
                 "author_email": "requester@xxxxxxxxxx",
                 "author_name": "Joe User",
                 "build_url": canonical_url(job.build),
-                "builder_constraints": None,
+                "builder_constraints": [],
                 "distroseries_name": job.build.distroseries.name,
                 "fast_cleanup": True,
                 "git": True,
diff --git a/lib/lp/oci/tests/test_ocirecipebuildbehaviour.py b/lib/lp/oci/tests/test_ocirecipebuildbehaviour.py
index 9897717..27bf8b5 100644
--- a/lib/lp/oci/tests/test_ocirecipebuildbehaviour.py
+++ b/lib/lp/oci/tests/test_ocirecipebuildbehaviour.py
@@ -498,7 +498,7 @@ class TestAsyncOCIRecipeBuildBehaviour(
                     ),
                     "build_path": Equals(job.build.recipe.build_path),
                     "build_url": Equals(canonical_url(job.build)),
-                    "builder_constraints": Is(None),
+                    "builder_constraints": Equals([]),
                     "fast_cleanup": Is(True),
                     "git_repository": Equals(ref.repository.git_https_url),
                     "git_path": Equals(ref.name),
@@ -574,7 +574,7 @@ class TestAsyncOCIRecipeBuildBehaviour(
                     ),
                     "build_path": Equals(job.build.recipe.build_path),
                     "build_url": Equals(canonical_url(job.build)),
-                    "builder_constraints": Is(None),
+                    "builder_constraints": Equals([]),
                     "fast_cleanup": Is(True),
                     "git_repository": AfterPreprocessing(
                         urlsplit,
@@ -662,7 +662,7 @@ class TestAsyncOCIRecipeBuildBehaviour(
                     ),
                     "build_path": Equals(job.build.recipe.build_path),
                     "build_url": Equals(canonical_url(job.build)),
-                    "builder_constraints": Is(None),
+                    "builder_constraints": Equals([]),
                     "fast_cleanup": Is(True),
                     "git_repository": Equals(ref.repository.git_https_url),
                     "name": Equals(job.build.recipe.name),
diff --git a/lib/lp/snappy/tests/test_snapbuildbehaviour.py b/lib/lp/snappy/tests/test_snapbuildbehaviour.py
index 054df94..ef4e269 100644
--- a/lib/lp/snappy/tests/test_snapbuildbehaviour.py
+++ b/lib/lp/snappy/tests/test_snapbuildbehaviour.py
@@ -404,7 +404,7 @@ class TestAsyncSnapBuildBehaviour(StatsMixin, TestSnapBuildBehaviourBase):
                     "branch": Equals(branch.bzr_identity),
                     "build_source_tarball": Is(False),
                     "build_url": Equals(canonical_url(job.build)),
-                    "builder_constraints": Is(None),
+                    "builder_constraints": Equals([]),
                     "fast_cleanup": Is(True),
                     "name": Equals("test-snap"),
                     "private": Is(False),
@@ -455,7 +455,7 @@ class TestAsyncSnapBuildBehaviour(StatsMixin, TestSnapBuildBehaviourBase):
                     "arch_tag": Equals("i386"),
                     "build_source_tarball": Is(False),
                     "build_url": Equals(canonical_url(job.build)),
-                    "builder_constraints": Is(None),
+                    "builder_constraints": Equals([]),
                     "fast_cleanup": Is(True),
                     "git_repository": Equals(ref.repository.git_https_url),
                     "git_path": Equals(ref.name),
@@ -498,7 +498,7 @@ class TestAsyncSnapBuildBehaviour(StatsMixin, TestSnapBuildBehaviourBase):
                     "arch_tag": Equals("i386"),
                     "build_source_tarball": Is(False),
                     "build_url": Equals(canonical_url(job.build)),
-                    "builder_constraints": Is(None),
+                    "builder_constraints": Equals([]),
                     "fast_cleanup": Is(True),
                     "git_repository": Equals(ref.repository.git_https_url),
                     "name": Equals("test-snap"),
@@ -546,7 +546,7 @@ class TestAsyncSnapBuildBehaviour(StatsMixin, TestSnapBuildBehaviourBase):
                     "arch_tag": Equals("i386"),
                     "build_source_tarball": Is(False),
                     "build_url": Equals(canonical_url(job.build)),
-                    "builder_constraints": Is(None),
+                    "builder_constraints": Equals([]),
                     "fast_cleanup": Is(True),
                     "git_repository": AfterPreprocessing(
                         urlsplit,
@@ -616,7 +616,7 @@ class TestAsyncSnapBuildBehaviour(StatsMixin, TestSnapBuildBehaviourBase):
                     "arch_tag": Equals("i386"),
                     "build_source_tarball": Is(False),
                     "build_url": Equals(canonical_url(job.build)),
-                    "builder_constraints": Is(None),
+                    "builder_constraints": Equals([]),
                     "fast_cleanup": Is(True),
                     "git_repository": Equals(url),
                     "git_path": Equals("master"),
@@ -659,7 +659,7 @@ class TestAsyncSnapBuildBehaviour(StatsMixin, TestSnapBuildBehaviourBase):
                     "arch_tag": Equals("i386"),
                     "build_source_tarball": Is(False),
                     "build_url": Equals(canonical_url(job.build)),
-                    "builder_constraints": Is(None),
+                    "builder_constraints": Equals([]),
                     "fast_cleanup": Is(True),
                     "git_repository": Equals(url),
                     "name": Equals("test-snap"),
diff --git a/lib/lp/soyuz/tests/test_binarypackagebuildbehaviour.py b/lib/lp/soyuz/tests/test_binarypackagebuildbehaviour.py
index 581b5b6..ea4a2db 100644
--- a/lib/lp/soyuz/tests/test_binarypackagebuildbehaviour.py
+++ b/lib/lp/soyuz/tests/test_binarypackagebuildbehaviour.py
@@ -167,7 +167,7 @@ class TestBinaryBuildPackageBehaviour(StatsMixin, TestCaseWithFactory):
             "archives": archives,
             "build_debug_symbols": archive.build_debug_symbols,
             "build_url": canonical_url(build),
-            "builder_constraints": None,
+            "builder_constraints": [],
             "distribution": das.distroseries.distribution.name,
             "fast_cleanup": builder.virtualized,
             "image_type": "chroot",
diff --git a/lib/lp/soyuz/tests/test_livefsbuildbehaviour.py b/lib/lp/soyuz/tests/test_livefsbuildbehaviour.py
index 42e736b..cf49b80 100644
--- a/lib/lp/soyuz/tests/test_livefsbuildbehaviour.py
+++ b/lib/lp/soyuz/tests/test_livefsbuildbehaviour.py
@@ -208,7 +208,7 @@ class TestAsyncLiveFSBuildBehaviour(TestLiveFSBuildBehaviourBase):
                 "archives": expected_archives,
                 "arch_tag": "i386",
                 "build_url": canonical_url(job.build),
-                "builder_constraints": None,
+                "builder_constraints": [],
                 "datestamp": "20140425-103800",
                 "fast_cleanup": True,
                 "pocket": "release",
diff --git a/lib/lp/translations/tests/test_translationtemplatesbuildbehaviour.py b/lib/lp/translations/tests/test_translationtemplatesbuildbehaviour.py
index be9c1cd..2441b32 100644
--- a/lib/lp/translations/tests/test_translationtemplatesbuildbehaviour.py
+++ b/lib/lp/translations/tests/test_translationtemplatesbuildbehaviour.py
@@ -113,7 +113,7 @@ class TestTranslationTemplatesBuildBehaviour(
                     "archive_private": False,
                     "branch_url": behaviour.build.branch.composePublicURL(),
                     "build_url": canonical_url(behaviour.build),
-                    "builder_constraints": None,
+                    "builder_constraints": [],
                     "fast_cleanup": True,
                     "series": das.distroseries.name,
                 },