mirror of
https://github.com/token2/snapd.git
synced 2026-03-13 11:15:47 -07:00
44 lines
1.7 KiB
YAML
44 lines
1.7 KiB
YAML
summary: Ensure `snap debug changes|tasks|task` commands work
|
|
|
|
details: |
|
|
The command `snap debug state` should report change state from a given
|
|
"state.json" file. It should be able to list changes, show changes,
|
|
tasks. It should be able to provide a Graphviz output. This test
|
|
verifies the command line for all these operations.
|
|
|
|
prepare: |
|
|
snap install hello-world
|
|
# The debug commands access state.json directly, snapd should be stopped
|
|
systemctl stop snapd.{socket,service}
|
|
|
|
if [[ "$SPREAD_SYSTEM" == ubuntu-1* ]]; then
|
|
apt install -y graphviz
|
|
fi
|
|
|
|
restore: |
|
|
systemctl start snapd.{socket,service}
|
|
|
|
execute: |
|
|
echo "Changes can be listed"
|
|
snap debug state --changes /var/lib/snapd/state.json | MATCH "seed .*Initialize system state"
|
|
snap debug state /var/lib/snapd/state.json | MATCH "seed .*Initialize system state"
|
|
|
|
echo "Snap changes defaults to state.json in the current directory"
|
|
cd /var/lib/snapd
|
|
snap debug state --changes | MATCH "install-snap .*Install \"hello-world\" snap"
|
|
|
|
echo "Tasks can be listed"
|
|
snap debug state --change=1 /var/lib/snapd/state.json | MATCH "mark-seeded .*Mark system seeded"
|
|
|
|
# find the id of mark-seeded task
|
|
TASK_ID=$(snap debug state --change=1 /var/lib/snapd/state.json | grep "mark-seeded" | awk '{print $2}')
|
|
|
|
echo "Individual task can be examined"
|
|
snap debug state --task="$TASK_ID" /var/lib/snapd/state.json | MATCH "kind: mark-seeded"
|
|
snap debug state --task="$TASK_ID" /var/lib/snapd/state.json | MATCH "summary: Mark system seeded"
|
|
|
|
# precondition check, dot shouldn't fail
|
|
if [[ "$SPREAD_SYSTEM" == ubuntu-1* ]]; then
|
|
snap debug state --change=1 --dot /var/lib/snapd/state.json | dot -Tpng > out.png
|
|
fi
|