SHA256
1
0
forked from pool/cloud-init
cloud-init/0002-Add-tests-for-additional-openSUSE-distro-condition-m.patch
Robert Schweikert 3ed6919cb4 - Update to version 18.4 (bsc#1087331, bsc#1097388, boo#1111427, bsc#1095627)
+ Remove cloud-init-no-user-lock-if-already-locked.patch
    cloud-init 18.4 is not supported on SLE 11 code base
  + Remove 0001-Support-chrony-configuration-lp-1731619.patch
    Included upstream
  + Remove 0003-Distro-dependent-chrony-config-file.patch
    Included upstream
  + Remove 0001-switch-to-using-iproute2-tools.patch
    Included upstream
  + Remove cloud-init-no-python-linux-dist.patch
    Included upstream
  + Remove cloud-init-no-trace-empt-sect.patch
    Included upstream
  + Remove cloud-init-setpath-dsitentify.patch
    Included upstream
  + Modify fix-default-systemd-unit-dir.patch
    Use pkg-config, only modify the generator
  + Remove cloud-init-sysconfig-netpathfix.patch
    Fixed upstream
  + Removed cloud-init-skip-ovf-tests.patch
    Fixed upstream
  + Removed cloud-init-translate-netconf-ipv4-keep-gw.patch
    Fixed upstream
  + Add cloud-init-template-py2.patch avoid Python 3 dependency when we build
    for distros with Python 2 support
  + Add 0001-Follow-the-ever-bouncing-ball-for-openSUSE-distribut.patch
  + Add 0002-Add-tests-for-additional-openSUSE-distro-condition-m.patch
  + Add cloud-init-sysconf-path.patch
  + Add cloud-init-sysconf-ethsetup.patch
  + Add 0001-Fix-the-service-order-for-SUSE-distributions.patch

OBS-URL: https://build.opensuse.org/package/show/Cloud:Tools/cloud-init?expand=0&rev=121
2018-10-25 18:58:19 +00:00

110 lines
3.6 KiB
Diff

From 33d988113c3897ea7e0d1eda402d30dfec119602 Mon Sep 17 00:00:00 2001
From: Robert Schweikert <rjschwei@suse.com>
Date: Sun, 21 Oct 2018 08:46:15 -0400
Subject: [PATCH 2/2] - Add tests for additional openSUSE distro condition
mechanisms
---
cloudinit/tests/test_util.py | 75 ++++++++++++++++++++++++++++++++++----------
1 file changed, 59 insertions(+), 16 deletions(-)
diff --git a/cloudinit/tests/test_util.py b/cloudinit/tests/test_util.py
index 749a3846..c3f52c7b 100644
--- a/cloudinit/tests/test_util.py
+++ b/cloudinit/tests/test_util.py
@@ -18,25 +18,51 @@ MOUNT_INFO = [
]
OS_RELEASE_SLES = dedent("""\
- NAME="SLES"\n
- VERSION="12-SP3"\n
- VERSION_ID="12.3"\n
- PRETTY_NAME="SUSE Linux Enterprise Server 12 SP3"\n
- ID="sles"\nANSI_COLOR="0;32"\n
- CPE_NAME="cpe:/o:suse:sles:12:sp3"\n
+ NAME="SLES"
+ VERSION="12-SP3"
+ VERSION_ID="12.3"
+ PRETTY_NAME="SUSE Linux Enterprise Server 12 SP3"
+ ID="sles"
+ ANSI_COLOR="0;32"
+ CPE_NAME="cpe:/o:suse:sles:12:sp3"
""")
OS_RELEASE_OPENSUSE = dedent("""\
-NAME="openSUSE Leap"
-VERSION="42.3"
-ID=opensuse
-ID_LIKE="suse"
-VERSION_ID="42.3"
-PRETTY_NAME="openSUSE Leap 42.3"
-ANSI_COLOR="0;32"
-CPE_NAME="cpe:/o:opensuse:leap:42.3"
-BUG_REPORT_URL="https://bugs.opensuse.org"
-HOME_URL="https://www.opensuse.org/"
+ NAME="openSUSE Leap"
+ VERSION="42.3"
+ ID=opensuse
+ ID_LIKE="suse"
+ VERSION_ID="42.3"
+ PRETTY_NAME="openSUSE Leap 42.3"
+ ANSI_COLOR="0;32"
+ CPE_NAME="cpe:/o:opensuse:leap:42.3"
+ BUG_REPORT_URL="https://bugs.opensuse.org"
+ HOME_URL="https://www.opensuse.org/"
+""")
+
+OS_RELEASE_OPENSUSE_L15 = dedent("""\
+ NAME="openSUSE Leap"
+ VERSION="15.0"
+ ID="opensuse-leap"
+ ID_LIKE="suse opensuse"
+ VERSION_ID="15.0"
+ PRETTY_NAME="openSUSE Leap 15.0"
+ ANSI_COLOR="0;32"
+ CPE_NAME="cpe:/o:opensuse:leap:15.0"
+ BUG_REPORT_URL="https://bugs.opensuse.org"
+ HOME_URL="https://www.opensuse.org/"
+""")
+
+OS_RELEASE_OPENSUSE_TW = dedent("""\
+ NAME="openSUSE Tumbleweed"
+ ID="opensuse-tumbleweed"
+ ID_LIKE="opensuse suse"
+ VERSION_ID="20180920"
+ PRETTY_NAME="openSUSE Tumbleweed"
+ ANSI_COLOR="0;32"
+ CPE_NAME="cpe:/o:opensuse:tumbleweed:20180920"
+ BUG_REPORT_URL="https://bugs.opensuse.org"
+ HOME_URL="https://www.opensuse.org/"
""")
OS_RELEASE_CENTOS = dedent("""\
@@ -453,6 +479,23 @@ class TestGetLinuxDistro(CiTestCase):
dist = util.get_linux_distro()
self.assertEqual(('opensuse', '42.3', platform.machine()), dist)
+ @mock.patch('cloudinit.util.load_file')
+ def test_get_linux_opensuse_l15(self, m_os_release, m_path_exists):
+ """Verify we get the correct name and machine arch on OpenSUSE."""
+ m_os_release.return_value = OS_RELEASE_OPENSUSE_L15
+ m_path_exists.side_effect = TestGetLinuxDistro.os_release_exists
+ dist = util.get_linux_distro()
+ self.assertEqual(('opensuse-leap', '15.0', platform.machine()), dist)
+
+ @mock.patch('cloudinit.util.load_file')
+ def test_get_linux_opensuse_tw(self, m_os_release, m_path_exists):
+ """Verify we get the correct name and machine arch on OpenSUSE."""
+ m_os_release.return_value = OS_RELEASE_OPENSUSE_TW
+ m_path_exists.side_effect = TestGetLinuxDistro.os_release_exists
+ dist = util.get_linux_distro()
+ self.assertEqual(
+ ('opensuse-tumbleweed', '20180920', platform.machine()), dist)
+
@mock.patch('platform.dist')
def test_get_linux_distro_no_data(self, m_platform_dist, m_path_exists):
"""Verify we get no information if os-release does not exist"""
--
2.13.7