Skip to content

Commit

Permalink
TZ update to sync tier-0 testing
Browse files Browse the repository at this point in the history
remove containers host containers from disk on cleanup

Signed-off-by: Yariv Rachmani <[email protected]>
  • Loading branch information
Yarboa committed Jul 7, 2024
1 parent db67f30 commit 4c251ce
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions tests/e2e/lib/container
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ file: ${container_file} tag: ${container_tag}"
# Execute the container
eval "$(podman run -d \
--privileged \
--tz local \
--network podmanDualStack \
--name "${container_name}" \
--hostname "${container_name}" \
Expand Down
15 changes: 12 additions & 3 deletions tests/ffi/common/prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# shellcheck disable=SC1091
. ../../e2e/lib/utils

DROP_IN_DIR="/etc/containers/systemd/qm.container.d/"

prepare_test() {
qm_service_file=$(systemctl show -P SourcePath qm)
#create backup file for qm unit file
Expand All @@ -11,7 +13,6 @@ prepare_test() {
# Remove 'DropCapability=sys_resource' enable nested container in QM
exec_cmd "sed -i 's|DropCapability=sys_resource|#DropCapability=sys_resource|' \
${qm_service_file}"
exec_cmd "restorecon -RFv /var/lib/containers"
# Create qm container custom config folder
exec_cmd "mkdir -p /etc/containers/systemd/qm.container.d"
# FIXME: This action should be performed if necessary through systemd drop-in files.
Expand All @@ -23,14 +24,22 @@ prepare_test() {
}

disk_cleanup() {
# Clean large size files created by tests inside qm part
exec_cmd "systemctl stop qm"
remove_file=$(find /var/qm -size +2G)
exec_cmd "rm -f $remove_file"
remove_qm_custom_conf_files=$(find /etc/containers/systemd/qm.container.d -type f)
exec_cmd "rm -f $remove_qm_custom_conf_files"
# Clean drop-in files used for tests
if test -d "${DROP_IN_DIR=}"; then
exec_cmd "rm -f ${DROP_IN_DIR}"
fi
exec_cmd "systemctl deamon-reload"
exec_cmd "systemctl start qm"
# Clean large size files created by tests inside host part
remove_file=$(find /root -size +1G)
exec_cmd "rm -f $remove_file"
# Clean containers from disk
exec_cmd "podman rm -t0 --all"
exec_cmd "restorecon -RFv /var/lib/containers"
}

reload_config() {
Expand Down

0 comments on commit 4c251ce

Please sign in to comment.