Skip to content

Commit

Permalink
system-test: clean up a code where it retrieves pid
Browse files Browse the repository at this point in the history
Signed-off-by: Shizuo Fujita <[email protected]>
  • Loading branch information
Watson1978 authored and kenhys committed Nov 26, 2024
1 parent 814480a commit 782d37e
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions fluent-package/yum/systemd-test/downgrade-to-v4.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,22 +80,7 @@ test -x /usr/sbin/td-agent
test -x /usr/sbin/td-agent-gem

# Test: environmental variables
case ${distribution} in
centos|amazon)
# --value is not supported yet
pid=$(systemctl show td-agent --property=MainPID | cut -d'=' -f2)
;;
amazon)
if [ ! "$DISTRIBUTION_VERSION" = "2023" ]; then
pid=$(systemctl show td-agent --property=MainPID | cut -d'=' -f2)
else
pid=$(systemctl show td-agent --property=MainPID --value)
fi
;;
*)
pid=$(systemctl show td-agent --property=MainPID --value)
;;
esac
pid=$(eval $(systemctl show td-agent --property=MainPID) && echo $MainPID)
env_vars=$(sudo sed -e 's/\x0/\n/g' /proc/$pid/environ)
test $(eval $env_vars && echo $HOME) = "/var/lib/td-agent"
test $(eval $env_vars && echo $LOGNAME) = "td-agent"
Expand Down

0 comments on commit 782d37e

Please sign in to comment.