diff options
author | Dylan Richardson <dylan.richardson@mongodb.com> | 2022-02-10 22:30:15 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-02-10 23:42:21 +0000 |
commit | 4302c8724a45909d9a014ece2411db636c3b03f8 (patch) | |
tree | 5c248a3b73f7c144ccb64f55a8b128420a5d4c19 /buildscripts/tests | |
parent | 07bb54adafde83bb27692e9d72ae932f3efa7b15 (diff) | |
download | mongo-4302c8724a45909d9a014ece2411db636c3b03f8.tar.gz |
SERVER-63510: Fix apt packager for alpha nightly builds
Diffstat (limited to 'buildscripts/tests')
-rw-r--r-- | buildscripts/tests/test_packager.py | 47 |
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) |