Skip to content

Commit

Permalink
ci: add test to check the service status with updating from v4 (#755)
Browse files Browse the repository at this point in the history
This PR will add test to confirm that fluentd should be restarted with
updating from v4

---------

Signed-off-by: Shizuo Fujita <[email protected]>
Co-authored-by: Daijiro Fukuda <[email protected]>
  • Loading branch information
Watson1978 and daipom authored Dec 9, 2024
1 parent 48b9884 commit ade6bf0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
9 changes: 9 additions & 0 deletions fluent-package/apt/systemd-test/update-from-v4.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ sudo apt install -y curl ca-certificates
curl -fsSL https://toolbelt.treasuredata.com/sh/install-${distribution}-${code_name}-td-agent4.sh | sh

systemctl status --no-pager td-agent
main_pid=$(eval $(systemctl show td-agent --property=MainPID) && echo $MainPID)

# Generate garbage files
touch /etc/td-agent/a\ b\ c
Expand All @@ -18,6 +19,11 @@ for d in $(seq 1 10); do
touch /var/log/td-agent/$d.log
done

# When it updates from v4, the service needs to be stopped to restart fluentd after installation.
# Note: This behavior is not expected, and maybe it should be fixed.
# The cause is unknown. For deb, usually, restart should happen when the service was active before the update.
sudo systemctl stop td-agent

# Install the current
case $1 in
local)
Expand Down Expand Up @@ -49,6 +55,9 @@ esac
systemctl status --no-pager fluentd
systemctl status --no-pager td-agent

# Fluentd should be restarted when update from v4.
test $main_pid -ne $(eval $(systemctl show fluentd --property=MainPID) && echo $MainPID)

# Test: restoring td-agent service alias
sudo systemctl stop fluentd
sudo systemctl unmask td-agent
Expand Down
4 changes: 4 additions & 0 deletions fluent-package/yum/systemd-test/update-from-v4.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ sudo $DNF install -y td-agent-${td_agent_version}-1.*.x86_64

sudo systemctl enable --now td-agent
systemctl status --no-pager td-agent
main_pid=$(eval $(systemctl show td-agent --property=MainPID) && echo $MainPID)

# Generate garbage files
touch /etc/td-agent/a\ b\ c
Expand All @@ -40,6 +41,9 @@ systemctl status --no-pager fluentd # Migration process starts the service autom
sudo systemctl enable fluentd # Enable the unit name alias
systemctl status --no-pager td-agent

# Fluentd should be restarted when update from v4.
test $main_pid -ne $(eval $(systemctl show fluentd --property=MainPID) && echo $MainPID)

# Test: config migration
test -h /etc/td-agent
test -h /etc/fluent/fluentd.conf
Expand Down

0 comments on commit ade6bf0

Please sign in to comment.