Skip to content

Commit

Permalink
tests/core/snap-set-core-config: fix test for UC24
Browse files Browse the repository at this point in the history
There is no /etc/timezone file anymore on UC24.
  • Loading branch information
alfonsosanchezbeato committed Apr 30, 2024
1 parent 1f4ef54 commit 5db9425
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions tests/core/snap-set-core-config/task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,20 @@ execute: |
sysctl -n kernel.printk|MATCH "^4\s+"
echo "setting the timezone works"
tests.cleanup defer timedatectl set-timezone "$(cat /etc/timezone)"
get_tz() {
if os.query is-core-le 18; then
current_tz=$(cat /etc/timezone)
else
current_tz=$(timedatectl show | sed -n 's/^Timezone=//p')
fi
}
get_tz
tests.cleanup defer timedatectl set-timezone "$current_tz"
snap set system system.timezone=Europe/Malta
MATCH "Europe/Malta" < /etc/timezone
get_tz
test "$current_tz" = "Europe/Malta"
test "$(readlink -f /etc/localtime)" = "/usr/share/zoneinfo/Europe/Malta"
echo "and timezone setting shows up in the document"
Expand All @@ -150,7 +161,8 @@ execute: |
echo "and setting it again in snapd also works"
snap set system system.timezone=America/Lima
MATCH "America/Lima" < /etc/timezone
get_tz
test "$current_tz" = "America/Lima"
test "$(readlink -f /etc/localtime)" = "/usr/share/zoneinfo/America/Lima"
echo "and setting the timezone outside of snapd is reflected by snap get"
Expand Down

0 comments on commit 5db9425

Please sign in to comment.