diff --git a/python/mozbuild/mozbuild/artifacts.py b/python/mozbuild/mozbuild/artifacts.py index 64933c8e575d..442efa320d88 100644 --- a/python/mozbuild/mozbuild/artifacts.py +++ b/python/mozbuild/mozbuild/artifacts.py @@ -762,9 +762,16 @@ class ThunderbirdMixin(object): product = "thunderbird" try_tree = "try-comm-central" - @property - def candidate_trees(self): - return ["comm-central"] + nightly_candidate_trees = [ + "comm-central", + ] + beta_candidate_trees = [ + "releases/comm-beta", + ] + # The list below list should be updated when we have new ESRs. + esr_candidate_trees = [ + "releases/comm-esr91", + ] class LinuxThunderbirdArtifactJob(ThunderbirdMixin, LinuxArtifactJob): diff --git a/python/mozbuild/mozbuild/test/test_artifacts.py b/python/mozbuild/mozbuild/test/test_artifacts.py index f473fc81091d..a10721ef7029 100644 --- a/python/mozbuild/mozbuild/test/test_artifacts.py +++ b/python/mozbuild/mozbuild/test/test_artifacts.py @@ -70,9 +70,41 @@ class FakeThunderbirdJob(ThunderbirdMixin, FakeArtifactJob): class TestThunderbirdMixin(TestCase): - def test_candidate_trees(self): + def _assert_candidate_trees(self, version_display, expected_trees): + buildconfig.substs["MOZ_APP_VERSION_DISPLAY"] = version_display + job = FakeThunderbirdJob() - self.assertEqual(job.candidate_trees, ["comm-central"]) + self.assertGreater(len(job.candidate_trees), 0) + self.assertEqual(job.candidate_trees, expected_trees) + + def test_candidate_trees_with_beta_version(self): + self._assert_candidate_trees( + version_display="92.1b2", + expected_trees=ThunderbirdMixin.beta_candidate_trees, + ) + + def test_candidate_trees_with_esr_version(self): + self._assert_candidate_trees( + version_display="91.3.0esr", + expected_trees=ThunderbirdMixin.esr_candidate_trees, + ) + + def test_candidate_trees_with_nightly_version(self): + self._assert_candidate_trees( + version_display="95.0a1", + expected_trees=ThunderbirdMixin.nightly_candidate_trees, + ) + + def test_property_is_cached(self): + job = FakeThunderbirdJob() + expected_trees = ThunderbirdMixin.esr_candidate_trees + + buildconfig.substs["MOZ_APP_VERSION_DISPLAY"] = "91.3.0.esr" + self.assertEqual(job.candidate_trees, expected_trees) + # Because the property is cached, changing the + # `MOZ_APP_VERSION_DISPLAY` won't have any impact. + buildconfig.substs["MOZ_APP_VERSION_DISPLAY"] = "" + self.assertEqual(job.candidate_trees, expected_trees) if __name__ == "__main__":