summaryrefslogtreecommitdiff
path: root/tests/unittests/test_util.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unittests/test_util.py')
-rw-r--r--tests/unittests/test_util.py48
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/unittests/test_util.py b/tests/unittests/test_util.py
index eed387d5..1be778c6 100644
--- a/tests/unittests/test_util.py
+++ b/tests/unittests/test_util.py
@@ -269,6 +269,36 @@ OS_RELEASE_OPENEULER_20 = dedent(
"""
)
+OS_RELEASE_OPENCLOUDOS_8 = dedent(
+ """\
+ NAME="OpenCloudOS"
+ VERSION="8.6"
+ ID="OpenCloudOS"
+ ID_LIKE="rhel fedora"
+ VERSION_ID="8.6"
+ PLATFORM_ID="platform:oc8"
+ PRETTY_NAME="OpenCloudOS 8.6"
+ ANSI_COLOR="0;31"
+ CPE_NAME="cpe:/o:opencloudos:opencloudos:8"
+ HOME_URL="https://www.opencloudos.org/"
+ BUG_REPORT_URL="https://bugs.opencloudos.tech/"
+"""
+)
+
+OS_RELEASE_TENCENTOS_3 = dedent(
+ """\
+ NAME="TencentOS"
+ VERSION="3.1"
+ ID="TencentOS"
+ ID_LIKE="rhel fedora centos"
+ VERSION_ID="3.1"
+ PLATFORM_ID="platform:el3"
+ PRETTY_NAME="TencentOS 3.1"
+ ANSI_COLOR="0;31"
+ CPE_NAME="cpe:/o:tencentos:tencentos:3"
+"""
+)
+
REDHAT_RELEASE_CENTOS_6 = "CentOS release 6.10 (Final)"
REDHAT_RELEASE_CENTOS_7 = "CentOS Linux release 7.5.1804 (Core)"
REDHAT_RELEASE_REDHAT_6 = (
@@ -1130,6 +1160,22 @@ class TestGetLinuxDistro(CiTestCase):
self.assertEqual(("openEuler", "20.03", "LTS-SP2"), dist)
@mock.patch(M_PATH + "load_file")
+ def test_get_linux_opencloudos(self, m_os_release, m_path_exists):
+ """Verify get the correct name and release name on OpenCloudOS."""
+ m_os_release.return_value = OS_RELEASE_OPENCLOUDOS_8
+ m_path_exists.side_effect = TestGetLinuxDistro.os_release_exists
+ dist = util.get_linux_distro()
+ self.assertEqual(("OpenCloudOS", "8.6", ""), dist)
+
+ @mock.patch(M_PATH + "load_file")
+ def test_get_linux_tencentos(self, m_os_release, m_path_exists):
+ """Verify get the correct name and release name on TencentOS."""
+ m_os_release.return_value = OS_RELEASE_TENCENTOS_3
+ m_path_exists.side_effect = TestGetLinuxDistro.os_release_exists
+ dist = util.get_linux_distro()
+ self.assertEqual(("TencentOS", "3.1", ""), dist)
+
+ @mock.patch(M_PATH + "load_file")
def test_get_linux_opensuse(self, m_os_release, m_path_exists):
"""Verify we get the correct name and machine arch on openSUSE
prior to openSUSE Leap 15.
@@ -1245,10 +1291,12 @@ class TestGetVariant:
({"system": "linux", "dist": ("fedora",)}, "fedora"),
({"system": "linux", "dist": ("mariner",)}, "mariner"),
({"system": "linux", "dist": ("openEuler",)}, "openeuler"),
+ ({"system": "linux", "dist": ("OpenCloudOS",)}, "opencloudos"),
({"system": "linux", "dist": ("photon",)}, "photon"),
({"system": "linux", "dist": ("rhel",)}, "rhel"),
({"system": "linux", "dist": ("rocky",)}, "rocky"),
({"system": "linux", "dist": ("suse",)}, "suse"),
+ ({"system": "linux", "dist": ("TencentOS",)}, "tencentos"),
({"system": "linux", "dist": ("virtuozzo",)}, "virtuozzo"),
({"system": "linux", "dist": ("ubuntu",)}, "ubuntu"),
({"system": "linux", "dist": ("linuxmint",)}, "ubuntu"),