Skip to content

Commit

Permalink
Add test for newly supported strings
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikhail Sandakov committed Feb 16, 2024
1 parent 1f455ad commit 4a04ed6
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions pleskdistup/common/tests/versiontests.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,28 @@ def test_kernel_parse_no_build(self):
def test_kernel_parse_virtuozo(self):
self._check_parse("3.10.0-1160.90.1.vz7.200.7", "3.10.0-1160.90.1.vz7")

def test_kernel_start_with_prefix(self):
self._check_parse("kernel-3.10.0-1160.95.1.el7.x86_64", "3.10.0-1160.95.1.el7.x86_64")

def test_kernel_start_with_plus_prefix(self):
self._check_parse("kernel-plus-3.10.0-327.36.3.el7.centos.plus.x86_64", "3.10.0-327.36.3.el7.centos.plus.x86_64")

def test_kernel_parse_plus(self):
kernel = version.KernelVersion("3.10.0-327.36.3.el7.centos.plus.x86_64")
self.assertEqual(str(kernel), "3.10.0-327.36.3.el7.centos.plus.x86_64")
self.assertEqual(kernel.distro, "el7.centos.plus")
self.assertEqual(kernel.arch, "x86_64")

def test_kernel_starts_with_realtime_prefix(self):
self._check_parse("kernel-rt-core-3.10.0-1160.95.1.rt7.130.el7.x86_64", "3.10.0-1160.95.1.rt7.130.el7.x86_64")

def test_kernel_parse_realtime(self):
kernel = version.KernelVersion("3.10.0-1160.95.10.rt7.130.el7.x86_64")
self.assertEqual(str(kernel), "3.10.0-1160.95.10.rt7.130.el7.x86_64")
self.assertEqual(kernel.build, "1160.95.10")
self.assertEqual(kernel.distro, "rt7.130.el7")
self.assertEqual(kernel.arch, "x86_64")

def test_compare_simple_equal(self):
kernel1 = version.KernelVersion("3.10.0-1160.95.1.el7.x86_64")
kernel2 = version.KernelVersion("3.10.0-1160.95.1.el7.x86_64")
Expand Down

0 comments on commit 4a04ed6

Please sign in to comment.