SERVER-63510: Fix apt packager for alpha nightly builds

This commit is contained in:
Dylan Richardson 2022-02-10 22:30:15 +00:00 committed by Evergreen Agent
parent 07bb54adaf
commit 4302c8724a
2 changed files with 48 additions and 1 deletions

View File

@ -62,7 +62,7 @@ class Spec(object):
def is_nightly(self):
"""Return True if nightly."""
return bool(re.search("-$", self.version())) or bool(
re.search(r"\d-\d+-g[0-9a-f]+$", self.version()))
re.search(r"-g[0-9a-f]+$", self.version()))
def is_patch(self):
"""Return True if patch."""

View File

@ -0,0 +1,47 @@
"""Unit tests for the packager script."""
from dataclasses import dataclass
from unittest import TestCase
from buildscripts.packager import Spec
class TestPackager(TestCase):
"""Test packager.py"""
def test_is_nightly(self) -> None:
"""Test is_nightly."""
@dataclass
class Case:
"""Test case data"""
name: str
version: str
want: bool
cases = [
Case(
name="Waterfall alpha",
version="5.3.0-alpha-211-g546d77f",
want=True,
),
Case(
name="Waterfall",
version="5.3.0-211-g546d77f",
want=True,
),
Case(
name="Mainline",
version="5.3.0",
want=False,
),
Case(
name="Release candidate",
version="5.3.0-rc0",
want=False,
),
]
for case in cases:
with self.subTest(name=case.name):
spec = Spec(ver=case.version)
self.assertEqual(spec.is_nightly(), case.want)