Merge pull request #24352 from edsantiago/systemd-leak-cleanup

System tests: clean up unit file leaks
This commit is contained in:
openshift-merge-bot[bot]
2024-10-28 12:07:27 +00:00
committed by GitHub
2 changed files with 10 additions and 0 deletions

View File

@@ -31,6 +31,7 @@ function teardown() {
echo "# WARNING: systemctl stop failed in teardown: $output" >&3 echo "# WARNING: systemctl stop failed in teardown: $output" >&3
fi fi
run systemctl reset-failed "$SERVICE_NAME"
rm -f "$UNIT_FILE" rm -f "$UNIT_FILE"
systemctl daemon-reload systemctl daemon-reload
fi fi
@@ -97,6 +98,8 @@ function service_cleanup() {
run systemctl disable "$SERVICE_NAME" run systemctl disable "$SERVICE_NAME"
assert $status -eq 0 "Error disabling systemd unit $SERVICE_NAME: $output" assert $status -eq 0 "Error disabling systemd unit $SERVICE_NAME: $output"
run systemctl reset-failed "$SERVICE_NAME"
rm -f "$UNIT_FILE" rm -f "$UNIT_FILE"
systemctl daemon-reload systemctl daemon-reload
} }
@@ -272,6 +275,8 @@ LISTEN_FDNAMES=listen_fdnames" | sort)
run systemctl stop "$INSTANCE" run systemctl stop "$INSTANCE"
assert $status -eq 0 "Error stopping systemd unit $INSTANCE: $output" assert $status -eq 0 "Error stopping systemd unit $INSTANCE: $output"
run systemctl reset-failed "$INSTANCE"
rm -f $TEMPLATE_FILE rm -f $TEMPLATE_FILE
systemctl daemon-reload systemctl daemon-reload
} }

View File

@@ -37,6 +37,7 @@ function teardown() {
if [ $status -ne 0 ]; then if [ $status -ne 0 ]; then
echo "# WARNING: systemctl stop failed in teardown: $output" >&3 echo "# WARNING: systemctl stop failed in teardown: $output" >&3
fi fi
run systemctl reset-failed "$service"
rm -f "$UNIT_FILE" rm -f "$UNIT_FILE"
fi fi
done done
@@ -127,6 +128,8 @@ function service_cleanup() {
"state of service $service after systemctl stop" "state of service $service after systemctl stop"
fi fi
# reset-failed necessary to clean up stray systemd cruft
run systemctl reset-failed "$service"
rm -f "$UNIT_DIR/$service" rm -f "$UNIT_DIR/$service"
systemctl daemon-reload systemctl daemon-reload
} }
@@ -909,6 +912,8 @@ EOF
run_podman exec $QUADLET_CONTAINER_NAME cat /test_content/$file_name run_podman exec $QUADLET_CONTAINER_NAME cat /test_content/$file_name
is "$output" "$file_content" "contents of testfile in container volume" is "$output" "$file_content" "contents of testfile in container volume"
service_cleanup $QUADLET_SERVICE_NAME
rm -rf $tmp_path rm -rf $tmp_path
} }