summaryrefslogtreecommitdiff
path: root/buildscripts/tests
diff options
context:
space:
mode:
authorDylan Richardson <dylan.richardson@mongodb.com>2022-02-10 22:30:15 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-02-10 23:42:21 +0000
commit4302c8724a45909d9a014ece2411db636c3b03f8 (patch)
tree5c248a3b73f7c144ccb64f55a8b128420a5d4c19 /buildscripts/tests
parent07bb54adafde83bb27692e9d72ae932f3efa7b15 (diff)
downloadmongo-4302c8724a45909d9a014ece2411db636c3b03f8.tar.gz
SERVER-63510: Fix apt packager for alpha nightly builds
Diffstat (limited to 'buildscripts/tests')
-rw-r--r--buildscripts/tests/test_packager.py47
1 files changed, 47 insertions, 0 deletions
diff --git a/buildscripts/tests/test_packager.py b/buildscripts/tests/test_packager.py
new file mode 100644
index 00000000000..022c14c6c78
--- /dev/null
+++ b/buildscripts/tests/test_packager.py
@@ -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)