Permalink
Cannot retrieve contributors at this time
Fetching contributors…
| summary: Check that auto-refresh works | |
| prepare: | | |
| snap install --devmode jq | |
| restore: | | |
| . "$TESTSLIB/dirs.sh" | |
| execute: | | |
| . "$TESTSLIB/dirs.sh" | |
| echo "Auto refresh information is shown" | |
| output=$(snap refresh --time) | |
| for expected in ^schedule: ^last: ^next:; do | |
| echo "$output" | MATCH "$expected" | |
| done | |
| echo "Install a snap from stable" | |
| snap install test-snapd-tools | |
| snap list | MATCH 'test-snapd-tools +[0-9]+\.[0-9]+' | |
| snap set core refresh.schedule="0:00-23:59" | |
| systemctl stop snapd.{service,socket} | |
| echo "Modify the snap to track the edge channel" | |
| jq '.data.snaps["test-snapd-tools"].channel = "edge"' /var/lib/snapd/state.json > /var/lib/snapd/state.json.new | |
| mv /var/lib/snapd/state.json.new /var/lib/snapd/state.json | |
| echo "And force auto-refresh to happen" | |
| jq ".data[\"last-refresh\"] = \"2007-08-22T09:30:44.449455783+01:00\"" /var/lib/snapd/state.json > /var/lib/snapd/state.json.new | |
| mv /var/lib/snapd/state.json.new /var/lib/snapd/state.json | |
| systemctl start snapd.{service,socket} | |
| echo "wait for auto-refresh to happen" | |
| for _ in $(seq 120); do | |
| if snap changes|grep -q "Done.*Auto-refresh snap \"test-snapd-tools\""; then | |
| break | |
| fi | |
| echo "Ensure refresh" | |
| snap debug ensure-state-soon | |
| sleep 5 | |
| done | |
| echo "Ensure our snap got updated" | |
| snap list|MATCH "test-snapd-tools +[0-9]+\.[0-9]+\+fake1" | |
| echo "Ensure refresh.last is set" | |
| jq ".data[\"last-refresh\"]" /var/lib/snapd/state.json | MATCH "$(date +%Y)" |