Skip to content
Snippets Groups Projects
Commit 43636ecb authored by Antoine SCHILDKNECHT's avatar Antoine SCHILDKNECHT
Browse files

Update wowza test | refs #33160

parent 730c535a
No related branches found
No related tags found
No related merge requests found
......@@ -9,6 +9,8 @@ PACKAGES = [
"python3-dnspython", # for: test_caches
"python3-openssl", # for: test_ssl
"python3-psutil", # for: test_wowza
"python3-packaging", # for: test_wowza
"python3-lxml", # for: test_wowza
"python3-psycopg2", # for: test_postgresql
"python3-pydbus", # for: test_dns_records
"python3-requests", # for: test_nginx_status, test_nginx_vhosts, test_ssl, test_apt_proxy, test_ubicast_packages_access
......
......@@ -9,16 +9,20 @@ from pathlib import Path
import re
import subprocess # nosec: B404
import sys
import psutil
from defusedxml.ElementTree import parse
from psutil import net_connections
from packaging.version import parse as parse_version
from lxml import etree
sys.path.append(str(Path(__file__).parents[1].resolve()))
# pylint: disable=wrong-import-position
from utilities import logging as lg # noqa: E402
LATEST_VERSION = "4.7.7"
LATEST_VERSION = "4.8.5"
WOWZA_TUNE_FILE = "/usr/local/WowzaStreamingEngine/conf/Tune.xml"
def main():
......@@ -108,14 +112,21 @@ def check_version() -> tuple:
version = ".".join(re.findall(r"\d", line))
if not version:
lg.error("cannot find wWowza version")
lg.error("cannot find Wowza version")
errors += 1
if version != LATEST_VERSION:
lg.warning("using outdated version: {}".format(version))
warnings += 1
if parse_version(version) < parse_version(LATEST_VERSION):
lg.info(
"using outdated version: {0} < {1} (recommended)"
.format(version, LATEST_VERSION)
)
elif parse_version(version) > parse_version(LATEST_VERSION):
lg.success(
"using newer version than the recommended: {0} > {1} (recommended)"
.format(version, LATEST_VERSION)
)
else:
lg.success("using recommended version: {}".format(LATEST_VERSION))
lg.success("using the recommended version: {0}".format(version))
return warnings, errors
......@@ -130,13 +141,33 @@ def check_heap_size() -> tuple:
warnings = 0
errors = 0
cmd = "grep '<HeapSize>2000M</HeapSize>' /usr/local/WowzaStreamingEngine/conf/Tune.xml"
check_heap, _ = subprocess.getstatusoutput(cmd)
if check_heap != 0:
lg.warning("not using recommended heap size")
# Current total RAM extraction (in MB)
svmem = psutil.virtual_memory()
total_ram = round(svmem.total / 1024 / 1024)
# Configuration of the recommended wowza heap size regarding available RAM
if total_ram >= 15000:
recommended_heap_size = 8000
elif total_ram >= 7000:
recommended_heap_size = 4000
else:
recommended_heap_size = 2000
# Configured wowza heap size extraction
tune_xml = etree.parse(WOWZA_TUNE_FILE)
heap_size = tune_xml.find('Tune/HeapSize').text[0:-1]
if int(heap_size) < recommended_heap_size:
lg.warning(
"not using recommended heap size: {0}M < {1}M (recommended)"
.format(int(heap_size), recommended_heap_size)
)
warnings += 1
else:
lg.success("using recommended heap size")
lg.success(
"using recommended heap size or above: {0}M"
.format(int(heap_size))
)
return warnings, errors
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment