From 1f04130c00b21b58a6a7f663f8fe22a6f22b2f82 Mon Sep 17 00:00:00 2001 From: Robin Roth Date: Mon, 4 Jul 2016 15:57:57 +0200 Subject: [PATCH] add more distribution version tests (#16563) * ubuntu 16.04 * solaris 10, 11 * fedora 22, 25 Thanks Peter Oliver for providing the test data --- .../module_utils/test_distribution_version.py | 95 +++++++++++++++++++ 1 file changed, 95 insertions(+) diff --git a/test/units/module_utils/test_distribution_version.py b/test/units/module_utils/test_distribution_version.py index e8f61a6d39..663e369f92 100644 --- a/test/units/module_utils/test_distribution_version.py +++ b/test/units/module_utils/test_distribution_version.py @@ -307,6 +307,24 @@ BUG_REPORT_URL="http://bugs.debian.org/" 'distribution_release': u'wheezy', 'distribution_version': u'7.9'} }, + { + "platform.dist": [ + "Ubuntu", + "16.04", + "xenial" + ], + "input": { + "/etc/os-release": "NAME=\"Ubuntu\"\nVERSION=\"16.04 LTS (Xenial Xerus)\"\nID=ubuntu\nID_LIKE=debian\nPRETTY_NAME=\"Ubuntu 16.04 LTS\"\nVERSION_ID=\"16.04\"\nHOME_URL=\"http://www.ubuntu.com/\"\nSUPPORT_URL=\"http://help.ubuntu.com/\"\nBUG_REPORT_URL=\"http://bugs.launchpad.net/ubuntu/\"\nUBUNTU_CODENAME=xenial\n", + "/etc/lsb-release": "DISTRIB_ID=Ubuntu\nDISTRIB_RELEASE=16.04\nDISTRIB_CODENAME=xenial\nDISTRIB_DESCRIPTION=\"Ubuntu 16.04 LTS\"\n" + }, + "name": "Ubuntu 16.04", + "result": { + "distribution_release": "xenial", + "distribution": "Ubuntu", + "distribution_major_version": "16", + "distribution_version": "16.04" + } + }, { 'name': "Ubuntu 14.04", 'input': {'/etc/lsb-release': """DISTRIB_ID=Ubuntu @@ -523,7 +541,84 @@ DISTRIB_DESCRIPTION="CoreOS 976.0.0 (Coeur Rouge)" "/etc/release": " Oracle Solaris 11 11/11 X86\n Copyright (c) 1983, 2011, Oracle and/or its affiliates. All rights reserved.\n Assembled 18 October 2011\n" }, "platform.system": "SunOS" + }, + +{ + "name": "Solaris 11.3", + "platform.dist": [ + "", + "", + "" + ], + "input": { + "/etc/release": " Oracle Solaris 11.3 X86\n Copyright (c) 1983, 2015, Oracle and/or its affiliates. All rights reserved.\n Assembled 06 October 2015\n" + }, + "platform.system": "SunOS", + "result": { + "distribution_release": "Oracle Solaris 11.3 X86", + "distribution": "Solaris", + "distribution_version": "11.3" } +}, + +{ + "name": "Solaris 10", + "platform.dist": [ + "", + "", + "" + ], + "input": { + "/etc/release": " Oracle Solaris 10 1/13 s10x_u11wos_24a X86\n Copyright (c) 1983, 2013, Oracle and/or its affiliates. All rights reserved.\n Assembled 17 January 2013\n" + }, + "platform.system": "SunOS", + "result": { + "distribution_release": "Oracle Solaris 10 1/13 s10x_u11wos_24a X86", + "distribution": "Solaris", + "distribution_version": "10" + } +}, + +{ + "name": "Fedora 22", + "platform.dist": [ + "fedora", + "22", + "Twenty Two" + ], + "input": { + "/etc/redhat-release": "Fedora release 22 (Twenty Two)\n", + "/etc/os-release": "NAME=Fedora\nVERSION=\"22 (Twenty Two)\"\nID=fedora\nVERSION_ID=22\nPRETTY_NAME=\"Fedora 22 (Twenty Two)\"\nANSI_COLOR=\"0;34\"\nCPE_NAME=\"cpe:/o:fedoraproject:fedora:22\"\nHOME_URL=\"https://fedoraproject.org/\"\nBUG_REPORT_URL=\"https://bugzilla.redhat.com/\"\nREDHAT_BUGZILLA_PRODUCT=\"Fedora\"\nREDHAT_BUGZILLA_PRODUCT_VERSION=22\nREDHAT_SUPPORT_PRODUCT=\"Fedora\"\nREDHAT_SUPPORT_PRODUCT_VERSION=22\nPRIVACY_POLICY_URL=https://fedoraproject.org/wiki/Legal:PrivacyPolicy\n", + "/etc/system-release": "Fedora release 22 (Twenty Two)\n" + }, + "result": { + "distribution_release": "Twenty Two", + "distribution": "Fedora", + "distribution_major_version": "22", + "distribution_version": "22" + } +}, +{ + "platform.dist": [ + "fedora", + "25", + "Rawhide" + ], + "input": { + "/etc/redhat-release": "Fedora release 25 (Rawhide)\n", + "/etc/os-release": "NAME=Fedora\nVERSION=\"25 (Workstation Edition)\"\nID=fedora\nVERSION_ID=25\nPRETTY_NAME=\"Fedora 25 (Workstation Edition)\"\nANSI_COLOR=\"0;34\"\nCPE_NAME=\"cpe:/o:fedoraproject:fedora:25\"\nHOME_URL=\"https://fedoraproject.org/\"\nBUG_REPORT_URL=\"https://bugzilla.redhat.com/\"\nREDHAT_BUGZILLA_PRODUCT=\"Fedora\"\nREDHAT_BUGZILLA_PRODUCT_VERSION=rawhide\nREDHAT_SUPPORT_PRODUCT=\"Fedora\"\nREDHAT_SUPPORT_PRODUCT_VERSION=rawhide\nPRIVACY_POLICY_URL=https://fedoraproject.org/wiki/Legal:PrivacyPolicy\nVARIANT=\"Workstation Edition\"\nVARIANT_ID=workstation\n", + "/etc/system-release": "Fedora release 25 (Rawhide)\n" + }, + "name": "Fedora 25", + "result": { + "distribution_release": "Rawhide", + "distribution": "Fedora", + "distribution_major_version": "25", + "distribution_version": "25" + } +}, + + ] @unittest.skipIf(sys.version_info[0] >= 3, "Python 3 is not supported on targets (yet)")