From c0a40a77e6dbe4a97620d3440b29cefc3ebe29e6 Mon Sep 17 00:00:00 2001
From: Antoine Schildknecht <antoine.schildknecht@ubicast.eu>
Date: Thu, 3 Dec 2020 15:33:14 +0100
Subject: [PATCH] Fix recommended heap size check | refs #33160

---
 tests/scripts/test_wowza.py | 20 ++++----------------
 1 file changed, 4 insertions(+), 16 deletions(-)

diff --git a/tests/scripts/test_wowza.py b/tests/scripts/test_wowza.py
index 852f44bc..705d421b 100755
--- a/tests/scripts/test_wowza.py
+++ b/tests/scripts/test_wowza.py
@@ -9,7 +9,6 @@ from pathlib import Path
 import re
 import subprocess  # nosec: B404
 import sys
-import psutil
 
 from defusedxml.ElementTree import parse
 from psutil import net_connections
@@ -23,6 +22,7 @@ from utilities import logging as lg  # noqa: E402
 
 LATEST_VERSION = "4.8.5"
 WOWZA_TUNE_FILE = "/usr/local/WowzaStreamingEngine/conf/Tune.xml"
+WOWZA_RECOMMENDED_HEAP_SIZE = 2000
 
 
 def main():
@@ -141,28 +141,16 @@ def check_heap_size() -> tuple:
     warnings = 0
     errors = 0
 
-    # 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(
+    if int(heap_size) < WOWZA_RECOMMENDED_HEAP_SIZE:
+        lg.error(
             "not using recommended heap size: {0}M < {1}M (recommended)"
             .format(int(heap_size), recommended_heap_size)
         )
-        warnings += 1
+        errors += 1
     else:
         lg.success(
             "using recommended heap size or above: {0}M"
-- 
GitLab