From e91b4a29b197db9fbc91144a6e8c1a743530a7ed Mon Sep 17 00:00:00 2001 From: Douglas Schilling Landgraf Date: Wed, 31 Jul 2024 00:49:06 -0400 Subject: [PATCH] ffi: qm-oom-score-adj/test.sh improvement Received a request to add additional information when the value do not match for oom-score-adj. Using this opportunity to improve this test code to have a constant. Signed-off-by: Douglas Schilling Landgraf --- tests/ffi/qm-oom-score-adj/test.sh | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/tests/ffi/qm-oom-score-adj/test.sh b/tests/ffi/qm-oom-score-adj/test.sh index cc1e8406..abc9b755 100644 --- a/tests/ffi/qm-oom-score-adj/test.sh +++ b/tests/ffi/qm-oom-score-adj/test.sh @@ -20,24 +20,28 @@ QM_OOM_SCORE_ADJ=$(cat "/proc/$QM_PID/oom_score_adj") QM_FFI_OOM_SCORE_ADJ=$(podman exec -it qm /bin/bash -c "cat /proc/$QM_FFI_PID/oom_score_adj" | tr -d '\r') +# Define a constant for the oom_score_adj value # "500" is the oom_score_adj defined for the qm/qm.container. -if [ "$QM_OOM_SCORE_ADJ" -eq "500" ]; then - info_message "PASS: qm.container oom_score_adj value == 500" +OOM_SCORE_ADJ_EXPECTED=500 + +if [ "$QM_OOM_SCORE_ADJ" -eq "$OOM_SCORE_ADJ_EXPECTED" ]; then + info_message "PASS: qm.container oom_score_adj value == $OOM_SCORE_ADJ_EXPECTED" else - info_message "FAIL: qm.container oom_score_adj value != 500" + info_message "FAIL: qm.container oom_score_adj value != $OOM_SCORE_ADJ_EXPECTED. Current value is ${QM_OOM_SCORE_ADJ}" exit 1 fi - # "750" is the oom_score_adj defined in the qm/containers.conf as default value # for the containers that would run inside of the qm container. -if [ "$QM_FFI_OOM_SCORE_ADJ" -eq "750" ]; then - info_message "PASS: qm containers oom_score_adj == 750" +# Check the oom_score_adj value for QM FFI +FFI_OOM_SCORE_ADJ_EXPECTED=750 + +if [ "$QM_FFI_OOM_SCORE_ADJ" -eq "$FFI_OOM_SCORE_ADJ_EXPECTED" ]; then + info_message "PASS: qm containers oom_score_adj == $FFI_OOM_SCORE_ADJ_EXPECTED" else - info_message "FAIL: qm containers oom_score_adj != 750" + info_message "FAIL: qm containers oom_score_adj != $FFI_OOM_SCORE_ADJ_EXPECTED. Current value is ${QM_FFI_OOM_SCORE_ADJ}" exit 1 fi - podman exec -it qm /bin/bash -c "podman stop ffi-qm > /dev/null"