Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removes the base_product check from is_suma functions #396

Merged
merged 6 commits into from
Sep 19, 2024
Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 43 additions & 6 deletions usr/share/lib/img_proof/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import json
import pytest
import xml.etree.ElementTree as ET

from susepubliccloudinfoclient import infoserverrequests

Expand Down Expand Up @@ -146,31 +147,53 @@ def f():


@pytest.fixture()
def is_suma_server(host, get_baseproduct):
def is_suma_server(host, get_baseproduct, get_suma_version):
def f():
suma_server_product = '/etc/products.d/SUSE-Manager-Server.prod'
suma_server = host.file(suma_server_product)
base_product = get_baseproduct()

suma_version = get_suma_version(suma_server_product)

if suma_version and suma_version.startswith('4'):
# For suma 4.3 baseproduct HAS to be SUMA server
return all([
suma_server.exists,
suma_server.is_file,
base_product == suma_server_product
])
# For suma >=5 baseproduct has to be Micro
# SUMA is included as an additional product
sle_micro_product = '/etc/products.d/SLE-Micro.prod'
return all([
suma_server.exists,
suma_server.is_file,
base_product == suma_server_product
apozsuse marked this conversation as resolved.
Show resolved Hide resolved
base_product == sle_micro_product
])
return f


@pytest.fixture()
def is_suma_proxy(host, get_baseproduct):
def is_suma_proxy(host, get_baseproduct, get_suma_version):
def f():
suma_proxy_product = '/etc/products.d/SUSE-Manager-Proxy.prod'
suma_proxy = host.file(suma_proxy_product)
base_product = get_baseproduct()

suma_version = get_suma_version(suma_proxy_product)

if suma_version and suma_version.startswith('4'):
# For suma 4.3 baseproduct HAS to be SUMA proxy
return all([
suma_proxy.exists,
suma_proxy.is_file,
base_product == suma_proxy_product
])
# For suma >=5 baseproduct has to be Micro
# SUMA is included as an additional product
sle_micro_product = '/etc/products.d/SLE-Micro.prod'
return all([
suma_proxy.exists,
suma_proxy.is_file,
base_product == suma_proxy_product
base_product == sle_micro_product
])
return f

Expand All @@ -182,6 +205,20 @@ def f():
return f


@pytest.fixture()
def get_suma_version(host):
def f(product_file):
version = ''
try:
suma_product = host.file(product_file)
xmlroot = ET.fromstring(suma_product.content_string)
version = xmlroot.find('./version').text
except Exception:
pass
return version
return f


@pytest.fixture()
def is_sles_sapcal(host):
def f():
Expand Down
Loading