summaryrefslogtreecommitdiff
path: root/buildscripts/tests
diff options
context:
space:
mode:
authorDavid Bradford <david.bradford@mongodb.com>2022-05-17 01:04:31 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-05-17 01:44:05 +0000
commit3b4067a108295b079c3d43027caffe2e2c66d7d0 (patch)
treedd6d2b4f678fd649f5cb92883a98e9fea7015557 /buildscripts/tests
parenta672dcd5658bdb7117de384e50e1747e610a5684 (diff)
downloadmongo-3b4067a108295b079c3d43027caffe2e2c66d7d0.tar.gz
SERVER-65937: Support different fcv tags for lts and continuous multiversion tests
Diffstat (limited to 'buildscripts/tests')
-rw-r--r--buildscripts/tests/resmokelib/multiversion/__init__.py1
-rw-r--r--buildscripts/tests/resmokelib/multiversion/test_multiversion_service.py59
2 files changed, 60 insertions, 0 deletions
diff --git a/buildscripts/tests/resmokelib/multiversion/__init__.py b/buildscripts/tests/resmokelib/multiversion/__init__.py
new file mode 100644
index 00000000000..4b7a2bb941b
--- /dev/null
+++ b/buildscripts/tests/resmokelib/multiversion/__init__.py
@@ -0,0 +1 @@
+"""Empty."""
diff --git a/buildscripts/tests/resmokelib/multiversion/test_multiversion_service.py b/buildscripts/tests/resmokelib/multiversion/test_multiversion_service.py
new file mode 100644
index 00000000000..1a067f1ff15
--- /dev/null
+++ b/buildscripts/tests/resmokelib/multiversion/test_multiversion_service.py
@@ -0,0 +1,59 @@
+"""Unit tests for multiversion_service.py."""
+from unittest import TestCase
+
+from packaging.version import Version
+
+import buildscripts.resmokelib.multiversion.multiversion_service as under_test
+
+# pylint: disable=missing-docstring,invalid-name
+
+
+class TestTagStr(TestCase):
+ def test_require_fcv_tag_should_be_returned(self):
+ self.assertEqual(under_test.tag_str(Version("6.0")), "requires_fcv_60")
+ self.assertEqual(under_test.tag_str(Version("5.3")), "requires_fcv_53")
+ self.assertEqual(under_test.tag_str(Version("31.41")), "requires_fcv_3141")
+
+
+class TestGetVersion(TestCase):
+ def test_version_should_be_extracted(self):
+ mongo_version = under_test.MongoVersion(mongo_version="6.0.0-rc5-18-gbcdfaa9035b")
+
+ self.assertEqual(mongo_version.get_version(), Version("6.0"))
+
+ def test_incompatible_version_should_raise_an_exception(self):
+ mongo_version = under_test.MongoVersion(mongo_version="not_a_version")
+
+ with self.assertRaises(ValueError):
+ mongo_version.get_version()
+
+
+class TestCalculateFcvConstants(TestCase):
+ def test_fcv_constants_should_be_accurate_for_lts_testing(self):
+ mongo_version = under_test.MongoVersion(mongo_version="6.0")
+ mongo_releases = under_test.MongoReleases(
+ **{
+ "featureCompatibilityVersions": [
+ "4.0", "4.2", "4.4", "4.7", "4.8", "4.9", "5.0", "5.1", "5.2", "5.3", "6.0",
+ "100.0"
+ ],
+ "longTermSupportReleases": ["4.0", "4.2", "4.4", "5.0"],
+ })
+
+ multiversion_service = under_test.MultiversionService(
+ mongo_version=mongo_version,
+ mongo_releases=mongo_releases,
+ )
+
+ fcv_constants = multiversion_service.calculate_fcv_constants()
+
+ self.assertEqual(fcv_constants.latest, Version("6.0"))
+ self.assertEqual(fcv_constants.last_continuous, Version("5.3"))
+ self.assertEqual(fcv_constants.last_lts, Version("5.0"))
+ self.assertEqual(fcv_constants.requires_fcv_tag_list,
+ [Version(v) for v in ["5.1", "5.2", "5.3", "6.0"]])
+ self.assertEqual(fcv_constants.requires_fcv_tag_list_continuous, [Version("6.0")])
+ self.assertEqual(fcv_constants.fcvs_less_than_latest, [
+ Version(v)
+ for v in ["4.0", "4.2", "4.4", "4.7", "4.8", "4.9", "5.0", "5.1", "5.2", "5.3"]
+ ])