Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions packaging/rpm/microshift.spec
Original file line number Diff line number Diff line change
Expand Up @@ -492,11 +492,11 @@ usermod -a -G hugetlbfs openvswitch

%systemd_post microshift.service

# only for install, not on upgrades
if [ $1 -eq 1 ]; then
# if crio was already started, restart it so it will catch /etc/crio/crio.conf.d/10-microshift.conf
systemctl is-active --quiet crio && systemctl restart --quiet crio || true
fi
# Restart crio and microshift services if they are active, both on installs and upgrades
# - Crio should pick up potential configuration updates
# - MicroShift should refresh running containers, pick up potential manifest updates, etc.
systemctl is-active --quiet crio && systemctl restart --quiet crio || true
systemctl is-active --quiet microshift && systemctl restart --quiet microshift || true

%pre selinux
%selinux_relabel_pre -s %{selinuxtype}
Expand Down Expand Up @@ -645,6 +645,9 @@ fi
# Use Git command to generate the log and replace the VERSION string
# LANG=C git log --date="format:%a %b %d %Y" --pretty="tformat:* %cd %an <%ae> VERSION%n- %s%n" packaging/rpm/microshift.spec
%changelog
* Mon Nov 11 2024 Gregory Giguashvili <[email protected]> 4.18.0
- Restart crio and microshift services on RPM post-install

* Fri Oct 25 2024 Pablo Acevedo Montserrat <[email protected]> 4.18.0
- USHIFT-4715: Add gateway-api-release-info rpm

Expand Down
41 changes: 41 additions & 0 deletions test/suites/rpm/install-and-upgrade-successful.robot
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,31 @@ Upgrade From Previous Version
Wait Until Greenboot Health Check Exited
[Teardown] Clean Up Test

Verify Service Restart On Upgrade
[Documentation] Upgrade the package verifying that crio and microshift
... services were restarted
# Install a package and start services
Install MicroShift RPM Packages From System Repo
... 4.${PREVIOUS_MINOR_VERSION}.*
... check_warnings=False
Start MicroShift
Wait For MicroShift
# Take active timestamps for services
${cts1}= Command Should Work systemctl show -p ActiveEnterTimestamp crio
${mts1}= Command Should Work systemctl show -p ActiveEnterTimestamp microshift
# Upgrade the package without explicitly restarting the service
Install MicroShift RPM Packages From Repo ${SOURCE_REPO_URL} ${TARGET_VERSION}
Wait For MicroShift
# Take active timestamps for services
${cts2}= Command Should Work systemctl show -p ActiveEnterTimestamp crio
${mts2}= Command Should Work systemctl show -p ActiveEnterTimestamp microshift
# Run the verification
Verify Service Active Timestamps
... ${cts1} ${mts1}
... ${cts2} ${mts2}

[Teardown] Clean Up Test


*** Keywords ***
Setup
Expand Down Expand Up @@ -115,3 +140,19 @@ Version Should Match
[Arguments] ${expected}
${version}= MicroShift Version
Should Be Equal As Strings ${version.gitVersion} ${expected}

Verify Service Active Timestamps
[Documentation] Verify the service timestamps are valid and different
[Arguments] ${cts1} ${mts1} ${cts2} ${mts2}
Should Not Be Empty ${cts1}
Should Not Be Empty ${mts1}
Should Not Be Empty ${cts2}
Should Not Be Empty ${mts2}
# Verify that timestamps exist (services were active)
Should Not Be Equal As Strings ${cts1} ActiveEnterTimestamp=
Should Not Be Equal As Strings ${mts1} ActiveEnterTimestamp=
Should Not Be Equal As Strings ${cts2} ActiveEnterTimestamp=
Should Not Be Equal As Strings ${mts2} ActiveEnterTimestamp=
# Verify that timestamps changed (services restarted)
Should Not Be Equal As Strings ${cts1} ${cts2}
Should Not Be Equal As Strings ${mts1} ${mts2}