From b3ccfb5de37ea6ebf1e4103654aae90933b4e6c3 Mon Sep 17 00:00:00 2001 From: Shizuo Fujita Date: Thu, 5 Dec 2024 11:35:02 +0900 Subject: [PATCH] ci: add test to check that fluentd should be restarted with updating from v4 Signed-off-by: Shizuo Fujita --- fluent-package/apt/systemd-test/update-from-v4.sh | 4 ++++ fluent-package/yum/systemd-test/update-from-v4.sh | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/fluent-package/apt/systemd-test/update-from-v4.sh b/fluent-package/apt/systemd-test/update-from-v4.sh index c2c0f8f2..67593c4e 100755 --- a/fluent-package/apt/systemd-test/update-from-v4.sh +++ b/fluent-package/apt/systemd-test/update-from-v4.sh @@ -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 @@ -49,6 +50,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 diff --git a/fluent-package/yum/systemd-test/update-from-v4.sh b/fluent-package/yum/systemd-test/update-from-v4.sh index 39626673..e7697602 100755 --- a/fluent-package/yum/systemd-test/update-from-v4.sh +++ b/fluent-package/yum/systemd-test/update-from-v4.sh @@ -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 @@ -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