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

ffi: Adding qm-omm-score-adj test #444

Merged
merged 1 commit into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
6 changes: 6 additions & 0 deletions tests/ffi/qm-oom-score-adj/main.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
summary: Test the qm's oom-score-adj values
test: /bin/bash ./test.sh
duration: 10m
tag: ffi
framework: shell
id: 6e6c5cea-efc7-48e9-8b4c-d355229ab1c2
41 changes: 41 additions & 0 deletions tests/ffi/qm-oom-score-adj/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash -euvx

# shellcheck disable=SC1091

. ../common/prepare.sh

export QM_HOST_REGISTRY_DIR="/var/qm/lib/containers/registry"
export QM_REGISTRY_DIR="/var/lib/containers/registry"

disk_cleanup
prepare_test
reload_config

# Copy container image registry to /var/qm/lib/containers
image_id=$(podman images | grep quay.io/centos-sig-automotive/ffi-tools | awk -F " " '{print $3}')
if [ ! -d "${QM_HOST_REGISTRY_DIR}" ]; then
exec_cmd "mkdir -p ${QM_HOST_REGISTRY_DIR}"
exec_cmd "podman push ${image_id} dir:${QM_HOST_REGISTRY_DIR}/tools-ffi:latest"
dougsland marked this conversation as resolved.
Show resolved Hide resolved
fi

podman exec -it qm /bin/bash -c \
"podman run -d --replace --name ffi-qm dir:${QM_REGISTRY_DIR}/tools-ffi:latest \
/usr/bin/sleep infinity > /dev/null"


QM_PID=$(podman inspect qm --format '{{.State.Pid}}' | tr -d '\r')
dougsland marked this conversation as resolved.
Show resolved Hide resolved
QM_FFI_PID=$(podman exec -it qm /bin/bash -c "podman inspect ffi-qm --format '{{.State.Pid}}'" | tr -d '\r')

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')


# "500" is the oom_score_adj defined for the qm/qm.container.
test "$QM_OOM_SCORE_ADJ" -eq "500"

# "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.
test "$QM_FFI_OOM_SCORE_ADJ" -eq "750"

podman exec -it qm /bin/bash -c "podman stop ffi-qm > /dev/null"

Loading