From 22484e6c071ae728360c282a4cdde2716141dbb7 Mon Sep 17 00:00:00 2001 From: Sean Marlow Date: Wed, 1 Aug 2018 09:59:57 -0600 Subject: [PATCH 1/2] Add SLE_15 repos. --- usr/share/lib/ipa/tests/SLES/conftest.py | 63 +++++++++++++++++++++++- 1 file changed, 62 insertions(+), 1 deletion(-) diff --git a/usr/share/lib/ipa/tests/SLES/conftest.py b/usr/share/lib/ipa/tests/SLES/conftest.py index 737c24a2..c7bc83ca 100644 --- a/usr/share/lib/ipa/tests/SLES/conftest.py +++ b/usr/share/lib/ipa/tests/SLES/conftest.py @@ -150,6 +150,65 @@ 'SLE-HA12-SP3-Updates' ] +SLE_15_BASE = [ + 'SLE-Module-Basesystem15-Debuginfo-Pool', + 'SLE-Module-Basesystem15-Debuginfo-Updates', + 'SLE-Module-Basesystem15-Pool', + 'SLE-Module-Basesystem15-Updates', + 'SLE-Product-SLES15-Pool', + 'SLE-Product-SLES15-Updates' +] + +SLE_15_MODULES = [ + 'SLE-Module-CAP-Tools15-Debuginfo-Pool', + 'SLE-Module-CAP-Tools15-Debuginfo-Updates', + 'SLE-Module-CAP-Tools15-Pool', + 'SLE-Module-CAP-Tools15-Updates', + 'SLE-Module-Containers15-Debuginfo-Pool', + 'SLE-Module-Containers15-Debuginfo-Updates', + 'SLE-Module-Containers15-Pool', + 'SLE-Module-Containers15-Updates', + 'SLE-Module-Desktop-Applications15-Debuginfo-Pool', + 'SLE-Module-Desktop-Applications15-Debuginfo-Updates', + 'SLE-Module-Desktop-Applications15-Pool', + 'SLE-Module-Desktop-Applications15-Updates', + 'SLE-Module-DevTools15-Debuginfo-Pool', + 'SLE-Module-DevTools15-Debuginfo-Updates', + 'SLE-Module-DevTools15-Pool', + 'SLE-Module-DevTools15-Updates', + 'SLE-Module-Legacy15-Debuginfo-Pool', + 'SLE-Module-Legacy15-Debuginfo-Updates', + 'SLE-Module-Legacy15-Pool', + 'SLE-Module-Legacy15-Updates', + 'SLE-Module-Public-Cloud15-Debuginfo-Pool', + 'SLE-Module-Public-Cloud15-Debuginfo-Updates', + 'SLE-Module-Public-Cloud15-Pool', + 'SLE-Module-Public-Cloud15-Updates', + 'SLE-Module-Server-Applications15-Debuginfo-Pool', + 'SLE-Module-Server-Applications15-Debuginfo-Updates', + 'SLE-Module-Server-Applications15-Pool', + 'SLE-Module-Server-Applications15-Updates', + 'SLE-Module-Web-Scripting15-Debuginfo-Pool', + 'SLE-Module-Web-Scripting15-Debuginfo-Updates', + 'SLE-Module-Web-Scripting15-Pool', + 'SLE-Module-Web-Scripting15-Updates' +] + +SLE_15_SAP = [ + 'SLE-Module-SAP-Applications15-Debuginfo-Pool', + 'SLE-Module-SAP-Applications15-Debuginfo-Updates', + 'SLE-Module-SAP-Applications15-Pool', + 'SLE-Module-SAP-Applications15-Updates', + 'SLE-Product-HA15-Debuginfo-Pool', + 'SLE-Product-HA15-Debuginfo-Updates', + 'SLE-Product-HA15-Pool', + 'SLE-Product-HA15-Updates', + 'SLE-Product-SLES_SAP15-Debuginfo-Pool', + 'SLE-Product-SLES_SAP15-Debuginfo-Updates', + 'SLE-Product-SLES_SAP15-Pool', + 'SLE-Product-SLES_SAP15-Updates' +] + SLES_REPOS = { '11.4': SLE_11_SP4_BASE + SLE_11_SP4_MODULES, '12': SLE_12_BASE + SLE_12_MODULES, @@ -159,7 +218,9 @@ '12-SP2': SLE_12_SP2_BASE + SLE_12_SP2_MODULES, '12-SP2-SAP': SLE_12_SP2_SAP, '12-SP3': SLE_12_SP3_BASE + SLE_12_SP3_MODULES, - '12-SP3-SAP': SLE_12_SP3_SAP + '12-SP3-SAP': SLE_12_SP3_SAP, + '15': SLE_15_BASE + SLE_15_MODULES, + '15-SAP': SLE_15_SAP } From 4ab98e75c98a2af594109a5b9662907c72a130f9 Mon Sep 17 00:00:00 2001 From: Sean Marlow Date: Fri, 10 Aug 2018 17:29:08 -0600 Subject: [PATCH 2/2] Cleanup tests for sle15. - License text and location changed. - Not all base repos are in the SAP images. - Remove SAP specific repo tests and combine into main repo test. --- .../tests/SLES/SAP/test_sles_sap_license.py | 20 +++++++++-- .../SLES/SAP/test_sles_sap_on_demand.yaml | 2 -- .../ipa/tests/SLES/SAP/test_sles_sap_repos.py | 18 ---------- usr/share/lib/ipa/tests/SLES/conftest.py | 34 +++++++++++++++---- .../lib/ipa/tests/SLES/test_sles_license.py | 8 ++++- .../lib/ipa/tests/SLES/test_sles_repos.py | 24 +++++++++++-- 6 files changed, 73 insertions(+), 33 deletions(-) delete mode 100644 usr/share/lib/ipa/tests/SLES/SAP/test_sles_sap_on_demand.yaml delete mode 100644 usr/share/lib/ipa/tests/SLES/SAP/test_sles_sap_repos.py diff --git a/usr/share/lib/ipa/tests/SLES/SAP/test_sles_sap_license.py b/usr/share/lib/ipa/tests/SLES/SAP/test_sles_sap_license.py index e7c7c0f8..2e7c03e3 100644 --- a/usr/share/lib/ipa/tests/SLES/SAP/test_sles_sap_license.py +++ b/usr/share/lib/ipa/tests/SLES/SAP/test_sles_sap_license.py @@ -3,10 +3,24 @@ def test_sles_sap_license(host): license_content = 'SUSE End User License Agreement' lic_dir = host.file(license_dir) - assert lic_dir.exists - assert lic_dir.is_directory + + try: + assert lic_dir.exists + assert lic_dir.is_directory + except AssertionError: + # SLE15 dir changed + license_dir = '/etc/YaST2/licenses/SLES_SAP' + lic_dir = host.file(license_dir) + assert lic_dir.exists + assert lic_dir.is_directory license = host.file(license_dir + '/license.txt') assert license.exists assert license.is_file - assert license.contains(license_content) + + try: + assert license.contains(license_content) + except AssertionError: + # SLE15 license text changed + license_content = 'SUSE(R) Linux Enterprise End User License Agreement' + assert license.contains(license_content) diff --git a/usr/share/lib/ipa/tests/SLES/SAP/test_sles_sap_on_demand.yaml b/usr/share/lib/ipa/tests/SLES/SAP/test_sles_sap_on_demand.yaml deleted file mode 100644 index 9df5ca6e..00000000 --- a/usr/share/lib/ipa/tests/SLES/SAP/test_sles_sap_on_demand.yaml +++ /dev/null @@ -1,2 +0,0 @@ -tests: - - test_sles_sap_repos diff --git a/usr/share/lib/ipa/tests/SLES/SAP/test_sles_sap_repos.py b/usr/share/lib/ipa/tests/SLES/SAP/test_sles_sap_repos.py deleted file mode 100644 index fbe07f09..00000000 --- a/usr/share/lib/ipa/tests/SLES/SAP/test_sles_sap_repos.py +++ /dev/null @@ -1,18 +0,0 @@ - - -def test_sles_sap_repos(check_zypper_repo, - determine_provider, - get_release_value, - get_sles_repos): - provider = determine_provider() - version = get_release_value('VERSION') - - for repo in get_sles_repos('%s-SAP' % version): - assert check_zypper_repo( - ''.join([ - 'SMT-http_smt-{provider}_susecloud_net:'.format( - provider=provider - ), - repo - ]) - ) diff --git a/usr/share/lib/ipa/tests/SLES/conftest.py b/usr/share/lib/ipa/tests/SLES/conftest.py index c7bc83ca..f8c87c91 100644 --- a/usr/share/lib/ipa/tests/SLES/conftest.py +++ b/usr/share/lib/ipa/tests/SLES/conftest.py @@ -154,7 +154,10 @@ 'SLE-Module-Basesystem15-Debuginfo-Pool', 'SLE-Module-Basesystem15-Debuginfo-Updates', 'SLE-Module-Basesystem15-Pool', - 'SLE-Module-Basesystem15-Updates', + 'SLE-Module-Basesystem15-Updates' +] + +SLE_15_PRODUCTS = [ 'SLE-Product-SLES15-Pool', 'SLE-Product-SLES15-Updates' ] @@ -212,15 +215,15 @@ SLES_REPOS = { '11.4': SLE_11_SP4_BASE + SLE_11_SP4_MODULES, '12': SLE_12_BASE + SLE_12_MODULES, - '12-SAP': SLE_12_SAP, + '12-SAP': SLE_12_SAP + SLE_12_BASE + SLE_12_MODULES, '12-SP1': SLE_12_SP1_BASE + SLE_12_SP1_MODULES, - '12-SP1-SAP': SLE_12_SP1_SAP, + '12-SP1-SAP': SLE_12_SP1_SAP + SLE_12_SP1_BASE + SLE_12_SP1_MODULES, '12-SP2': SLE_12_SP2_BASE + SLE_12_SP2_MODULES, - '12-SP2-SAP': SLE_12_SP2_SAP, + '12-SP2-SAP': SLE_12_SP2_SAP + SLE_12_SP2_BASE + SLE_12_SP2_MODULES, '12-SP3': SLE_12_SP3_BASE + SLE_12_SP3_MODULES, - '12-SP3-SAP': SLE_12_SP3_SAP, - '15': SLE_15_BASE + SLE_15_MODULES, - '15-SAP': SLE_15_SAP + '12-SP3-SAP': SLE_12_SP3_SAP + SLE_12_SP3_BASE + SLE_12_SP3_MODULES, + '15': SLE_15_BASE + SLE_15_MODULES + SLE_15_PRODUCTS, + '15-SAP': SLE_15_SAP + SLE_15_BASE + SLE_15_MODULES } @@ -229,3 +232,20 @@ def get_sles_repos(): def f(version): return SLES_REPOS[version] return f + + +@pytest.fixture() +def is_sles_sap(host): + def f(): + license_dir = '/etc/YaST2/licenses/ha' + lic_dir = host.file(license_dir) + try: + assert lic_dir.exists + assert lic_dir.is_directory + except AssertionError: + # SLE15 dir changed + license_dir = '/etc/YaST2/licenses/SLES_SAP' + lic_dir = host.file(license_dir) + return lic_dir.exists and lic_dir.is_directory + return True + return f diff --git a/usr/share/lib/ipa/tests/SLES/test_sles_license.py b/usr/share/lib/ipa/tests/SLES/test_sles_license.py index 9238710b..1fedd0f5 100644 --- a/usr/share/lib/ipa/tests/SLES/test_sles_license.py +++ b/usr/share/lib/ipa/tests/SLES/test_sles_license.py @@ -13,4 +13,10 @@ def test_sles_license(host): license = host.file(license_dir + '/license.txt') assert license.exists assert license.is_file - assert license.contains(license_content) + + try: + assert license.contains(license_content) + except Exception: + # SLE15 license text changed + license_content = 'SUSE(R) Linux Enterprise End User License Agreement' + assert license.contains(license_content) diff --git a/usr/share/lib/ipa/tests/SLES/test_sles_repos.py b/usr/share/lib/ipa/tests/SLES/test_sles_repos.py index 04ef1d65..312bfa5d 100644 --- a/usr/share/lib/ipa/tests/SLES/test_sles_repos.py +++ b/usr/share/lib/ipa/tests/SLES/test_sles_repos.py @@ -3,12 +3,18 @@ def test_sles_repos(check_zypper_repo, determine_provider, get_release_value, - get_sles_repos): + get_sles_repos, + is_sles_sap): provider = determine_provider() version = get_release_value('VERSION') + sap = is_sles_sap() + if sap: + version += '-SAP' + + missing_repos = [] for repo in get_sles_repos(version): - assert check_zypper_repo( + result = check_zypper_repo( ''.join([ 'SMT-http_smt-{provider}_susecloud_net:'.format( provider=provider @@ -16,3 +22,17 @@ def test_sles_repos(check_zypper_repo, repo ]) ) + if not result: + missing_repos.append( + ''.join([ + 'SMT-http_smt-{provider}_susecloud_net:'.format( + provider=provider + ), + repo + ]) + ) + + if missing_repos: + raise Exception( + 'Missing Repos: \n{0}'.format('\n'.join(missing_repos)) + )