summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorHaruki TSURUMOTO <fortune.rocket42@gmail.com>2021-12-07 23:23:45 +0900
committerGitHub <noreply@github.com>2021-12-07 08:23:45 -0600
commit0ed00ad9cdebc2d4dabd8bd6d7c901584963def5 (patch)
treedcc25a244e086eab826fd988db44a8fdfaa76bf5 /tests
parentcd40789a583c38423cea76355b375aa838893292 (diff)
downloadvyos-cloud-init-0ed00ad9cdebc2d4dabd8bd6d7c901584963def5.tar.gz
vyos-cloud-init-0ed00ad9cdebc2d4dabd8bd6d7c901584963def5.zip
Add miraclelinux support (#1128)
Diffstat (limited to 'tests')
-rw-r--r--tests/unittests/test_cli.py5
-rw-r--r--tests/unittests/test_util.py38
2 files changed, 41 insertions, 2 deletions
diff --git a/tests/unittests/test_cli.py b/tests/unittests/test_cli.py
index d0162673..e30e89a7 100644
--- a/tests/unittests/test_cli.py
+++ b/tests/unittests/test_cli.py
@@ -236,8 +236,9 @@ class TestCLI(test_helpers.FilesystemMockingTestCase):
"**Supported distros:** all",
(
"**Supported distros:** almalinux, alpine, centos, "
- "cloudlinux, debian, eurolinux, fedora, openEuler, "
- "opensuse, photon, rhel, rocky, sles, ubuntu, virtuozzo"
+ "cloudlinux, debian, eurolinux, fedora, miraclelinux, "
+ "openEuler, opensuse, photon, rhel, rocky, sles, ubuntu, "
+ "virtuozzo"
),
"**Config schema**:\n **resize_rootfs:** "
"(true/false/noblock)",
diff --git a/tests/unittests/test_util.py b/tests/unittests/test_util.py
index 1290cbc6..3b76ead8 100644
--- a/tests/unittests/test_util.py
+++ b/tests/unittests/test_util.py
@@ -185,6 +185,25 @@ OS_RELEASE_EUROLINUX_8 = dedent(
"""
)
+OS_RELEASE_MIRACLELINUX_8 = dedent(
+ """\
+ NAME="MIRACLE LINUX"
+ VERSION="8.4 (Peony)"
+ ID="miraclelinux"
+ ID_LIKE="rhel fedora"
+ PLATFORM_ID="platform:el8"
+ VERSION_ID="8"
+ PRETTY_NAME="MIRACLE LINUX 8.4 (Peony)"
+ ANSI_COLOR="0;31"
+ CPE_NAME="cpe:/o:cybertrust_japan:miracle_linux:8"
+ HOME_URL="https://www.cybertrust.co.jp/miracle-linux/"
+ DOCUMENTATION_URL="https://www.miraclelinux.com/support/miraclelinux8"
+ BUG_REPORT_URL="https://bugzilla.asianux.com/"
+ MIRACLELINUX_SUPPORT_PRODUCT="MIRACLE LINUX"
+ MIRACLELINUX_SUPPORT_PRODUCT_VERSION="8"
+"""
+)
+
OS_RELEASE_ROCKY_8 = dedent(
"""\
NAME="Rocky Linux"
@@ -255,6 +274,7 @@ REDHAT_RELEASE_REDHAT_7 = "Red Hat Enterprise Linux Server release 7.5 (Maipo)"
REDHAT_RELEASE_ALMALINUX_8 = "AlmaLinux release 8.3 (Purple Manul)"
REDHAT_RELEASE_EUROLINUX_7 = "EuroLinux release 7.9 (Minsk)"
REDHAT_RELEASE_EUROLINUX_8 = "EuroLinux release 8.4 (Vaduz)"
+REDHAT_RELEASE_MIRACLELINUX_8 = "MIRACLE LINUX release 8.4 (Peony)"
REDHAT_RELEASE_ROCKY_8 = "Rocky Linux release 8.3 (Green Obsidian)"
REDHAT_RELEASE_VIRTUOZZO_8 = "Virtuozzo Linux release 8"
REDHAT_RELEASE_CLOUDLINUX_8 = "CloudLinux release 8.4 (Valery Rozhdestvensky)"
@@ -755,6 +775,24 @@ class TestGetLinuxDistro(CiTestCase):
self.assertEqual(('eurolinux', '8.4', 'Vaduz'), dist)
@mock.patch('cloudinit.util.load_file')
+ def test_get_linux_miraclelinux8_rhrelease(self, m_os_release,
+ m_path_exists):
+ """Verify miraclelinux 8 read from redhat-release."""
+ m_os_release.return_value = REDHAT_RELEASE_MIRACLELINUX_8
+ m_path_exists.side_effect = TestGetLinuxDistro.redhat_release_exists
+ dist = util.get_linux_distro()
+ self.assertEqual(('miracle', '8.4', 'Peony'), dist)
+
+ @mock.patch('cloudinit.util.load_file')
+ def test_get_linux_miraclelinux8_osrelease(self, m_os_release,
+ m_path_exists):
+ """Verify miraclelinux 8 read from os-release."""
+ m_os_release.return_value = OS_RELEASE_MIRACLELINUX_8
+ m_path_exists.side_effect = TestGetLinuxDistro.os_release_exists
+ dist = util.get_linux_distro()
+ self.assertEqual(('miraclelinux', '8', 'Peony'), dist)
+
+ @mock.patch('cloudinit.util.load_file')
def test_get_linux_rocky8_rhrelease(self, m_os_release, m_path_exists):
"""Verify rocky linux 8 read from redhat-release."""
m_os_release.return_value = REDHAT_RELEASE_ROCKY_8