Skip to content

Commit

Permalink
ci: add downgrade test for no data lost
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 19, 2024
1 parent bcddff9 commit 91799bd
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 12 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/apt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ jobs:
- "update-to-next-version-service-status.sh disabled inactive"
- "update-to-next-version-with-auto-and-manual.sh"
- "update-to-next-major-version.sh"
- "update-without-data-lost.sh"
- "update-without-data-lost.sh v5 v6"
- "update-without-data-lost.sh v6 v5"
include:
- label: Debian bullseye amd64
rake-job: debian-bullseye
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/yum.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ jobs:
- "update-to-next-version-service-status.sh disabled inactive"
- "update-to-next-version-with-auto-and-manual.sh"
- "update-to-next-major-version.sh"
- "update-without-data-lost.sh"
- "update-without-data-lost.sh v5 v6"
- "update-without-data-lost.sh v6 v5"
include:
- label: AmazonLinux 2 x86_64
rake-job: amazonlinux-2
Expand Down Expand Up @@ -223,7 +224,8 @@ jobs:
- "update-to-next-version-service-status.sh disabled inactive"
- "update-to-next-version-with-auto-and-manual.sh"
- "update-to-next-major-version.sh"
- "update-without-data-lost.sh"
- "update-without-data-lost.sh v5 v6"
- "update-without-data-lost.sh v6 v5"
include:
- label: RockyLinux 8 x86_64
rake-job: rockylinux-8
Expand Down
37 changes: 32 additions & 5 deletions fluent-package/apt/systemd-test/update-without-data-lost.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,39 @@ set -exu

. $(dirname $0)/../commonvar.sh

v5_package="/host/${distribution}/pool/${code_name}/${channel}/*/*/fluent-package_*_${architecture}.deb"
v6_package="/host/v6-test/${distribution}/pool/${code_name}/${channel}/*/*/fluent-package_*_${architecture}.deb"

case "$1" in
v5)
package=$v5_package
;;
v6)
package=$v6_package
;;
*)
echo "Invalid argument: $1"
exit 1
;;
esac

case "$2" in
v5)
next_package=$v5_package
;;
v6)
next_package=$v6_package
;;
*)
echo "Invalid argument: $2"
exit 1
;;
esac

sudo apt install -V -y rsyslog

# Install the current
sudo apt install -V -y \
/host/${distribution}/pool/${code_name}/${channel}/*/*/fluent-package_*_${architecture}.deb
sudo apt install -V -y $package

# Set up configuration
cat < $(dirname $0)/../../test-tools/rsyslog.conf >> /etc/rsyslog.conf
Expand All @@ -30,9 +58,8 @@ sleep 1

sleep 1

# Update to the next major version
sudo apt install -V -y \
/host/v6-test/${distribution}/pool/${code_name}/${channel}/*/*/fluent-package_*_${architecture}.deb
# Update to the next version
sudo apt install -V -y --allow-downgrades $next_package
test $main_pid -eq $(systemctl show --value --property=MainPID fluentd)

# Main process should be replaced by USR2 signal
Expand Down
37 changes: 33 additions & 4 deletions fluent-package/yum/systemd-test/update-without-data-lost.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,40 @@ set -exu

. $(dirname $0)/commonvar.sh

v5_package="/host/${distribution}/${DISTRIBUTION_VERSION}/x86_64/Packages/fluent-package-*.rpm"
v6_package="/host/v6-test/${distribution}/${DISTRIBUTION_VERSION}/x86_64/Packages/fluent-package-*.rpm"

case "$1" in
v5)
package=$v5_package
;;
v6)
package=$v6_package
;;
*)
echo "Invalid argument: $1"
exit 1
;;
esac

command="install"
case "$2" in
v5)
next_package=$v5_package
command="downgrade" # Avoid error in AmazonLinux2
;;
v6)
next_package=$v6_package
;;
*)
echo "Invalid argument: $2"
exit 1
;;
esac

sudo $DNF install -y rsyslog

# Install the current
package="/host/${distribution}/${DISTRIBUTION_VERSION}/x86_64/Packages/fluent-package-[0-9]*.rpm"
sudo $DNF install -y $package

# Set up configuration
Expand All @@ -30,9 +60,8 @@ sleep 1

sleep 1

# Update to the next major version
next_package="/host/v6-test/${distribution}/${DISTRIBUTION_VERSION}/x86_64/Packages/fluent-package-*.rpm"
sudo $DNF install -y $next_package
# Update to the next version
sudo $DNF $command -y $next_package
test $main_pid -eq $(eval $(systemctl show fluentd --property=MainPID) && echo $MainPID)

# Main process should be replaced by USR2 signal
Expand Down

0 comments on commit 91799bd

Please sign in to comment.