Files
snapd/tests/main/remove-core/task.yaml
Andrew Phelps e016f71207 o/s/policy: allow "core" snap to be removed on classic systems (#13509)
* o/s/policy: allow "core" snap to be removed on classic systems

* tests/main/remove-core: spread test for removing core on classic systems

* o/s/policy: prevent removing core snap if snapd snap is not installed

* tests/main/remove-core: update to transition to snapd snap and then remove core

* o/snapstate: update TestEnsureRemovesVulnerableCoreSnap to install snapd snap

* o/s/policy: add error type for removing core if snapd snap not installed

* o/snapstate: update test to not mock snapd in the state

Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>

* o/s/policy: perform snapd check only when when completely removing core

Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>

* o/snapstate: revert unnecessary test change

Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>

* o/s/policy: drop unnecessary revision sequence check

Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>

* o/snapstate: tweak the comment about policy CanRemove

Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>

* o/s/policy: tweak core removal policy test

Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>

* o/p/policy: update comment explaining check for missing model base and boot style

Co-authored-by: Maciej Borzecki <maciek.borzecki@gmail.com>

* o/s/policy: correct formatting

* o/s/policy: add test for removing specific revision on classic system

* o/s/policy: remove outdated comment

---------

Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>
Co-authored-by: Maciej Borzecki <maciej.borzecki@canonical.com>
Co-authored-by: Maciej Borzecki <maciek.borzecki@gmail.com>
2024-01-24 08:55:13 +01:00

33 lines
1.2 KiB
YAML

summary: Check that we can remove core snap on classic systems.
details: |
This test checks that we can remove core snap on classic systems, as long as
snapd is installed as a snap. Classic systems do not have 'base' set in
their model. On UC systems, that would be interpreted as 'core' being the
base. On classic (non-hybrid) systems, that should be interpreted as there
not being a base required.
If snapd is not installed as a snap, then we can't remove the core snap
since it might be providing snapd.
systems: [ubuntu-22.04-64]
execute: |
# we should not be able to remove the core snap, since the snapd snap is not
# installed.
not snap remove core
# make sure that the model does not have 'base' set
snap model --assertion | NOMATCH 'base:'
# enable transitioning to the snapd snap
snap set core experimental.snapd-snap=true
snap debug ensure-state-soon
retry -n 30 snap watch --last=transition-to-snapd-snap
snap list snapd
# now remove the core snap, since we know that it isn't providing snapd
# anymore. this, in addition to this being a classic system, should allow us
# to remove the core snap.
snap remove core