Skip to content

Commit

Permalink
Merge pull request containers#24352 from edsantiago/systemd-leak-cleanup
Browse files Browse the repository at this point in the history
System tests: clean up unit file leaks
  • Loading branch information
openshift-merge-bot[bot] authored Oct 28, 2024
2 parents 95030db + 743a0d4 commit 0962a1e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/system/250-systemd.bats
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ function teardown() {
echo "# WARNING: systemctl stop failed in teardown: $output" >&3
fi

run systemctl reset-failed "$SERVICE_NAME"
rm -f "$UNIT_FILE"
systemctl daemon-reload
fi
Expand Down Expand Up @@ -97,6 +98,8 @@ function service_cleanup() {
run systemctl disable "$SERVICE_NAME"
assert $status -eq 0 "Error disabling systemd unit $SERVICE_NAME: $output"

run systemctl reset-failed "$SERVICE_NAME"

rm -f "$UNIT_FILE"
systemctl daemon-reload
}
Expand Down Expand Up @@ -272,6 +275,8 @@ LISTEN_FDNAMES=listen_fdnames" | sort)
run systemctl stop "$INSTANCE"
assert $status -eq 0 "Error stopping systemd unit $INSTANCE: $output"

run systemctl reset-failed "$INSTANCE"

rm -f $TEMPLATE_FILE
systemctl daemon-reload
}
Expand Down
5 changes: 5 additions & 0 deletions test/system/252-quadlet.bats
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ function teardown() {
if [ $status -ne 0 ]; then
echo "# WARNING: systemctl stop failed in teardown: $output" >&3
fi
run systemctl reset-failed "$service"
rm -f "$UNIT_FILE"
fi
done
Expand Down Expand Up @@ -127,6 +128,8 @@ function service_cleanup() {
"state of service $service after systemctl stop"
fi

# reset-failed necessary to clean up stray systemd cruft
run systemctl reset-failed "$service"
rm -f "$UNIT_DIR/$service"
systemctl daemon-reload
}
Expand Down Expand Up @@ -909,6 +912,8 @@ EOF
run_podman exec $QUADLET_CONTAINER_NAME cat /test_content/$file_name
is "$output" "$file_content" "contents of testfile in container volume"

service_cleanup $QUADLET_SERVICE_NAME

rm -rf $tmp_path
}

Expand Down

0 comments on commit 0962a1e

Please sign in to comment.