This changes the naming of the aspects feature to be "registry" instead
of bundle (i.e., a configuration space backed with its own storage) and
"view" instead of aspect. Once this lands, anyone that has this enabled
needs to unset the experimental flag and rename the state entry before
refreshing snapd and then re-enable.
Signed-off-by: Miguel Pires <miguel.pires@canonical.com>
* update gadget.yaml for nested remodel tests
* add new snaps with base: core24
* tests: fixes for uc24 nested tests
This change contains:
. fixes for model
. use of core24 snaps (jq, rsync and sh)
. test fixes
. using legacy scp in snapd-testing-tools remote-pull (to avoid errors)
* use -O when the scp version is -ge than 9
* re-enable hybrid-remodel test on noble
* update wording of remote.pull
* Adding more workers for nested tests
This is to avoid instances are cleaned before the execution finishes
* First list of changes to make nested tests run
* avoid using OVMF with 4M
* Check for cloud init status in uc24
* removed OVMF_SIZE var which is not used anymore
* fix merge issue
* update gadget.yaml for test-snapd-remove-pc-24 snap
* remove mbr and source: shim.efi.signed from gadget.yaml
* restoring source: shim.efi.signed in seed partition
* Fixed the incorrect uuid of the core24 snap
* fixed the snapcraft.yaml for jq-core24
* enable nested tests for uc24
* fix issue related to cloud init
* some test fixes
* Add missing details for tests
* Adding missing details for nested tests
* addin support for ubuntu-24.04 in upload-snapd-to-gce
* updated the password for external users in spread.yaml
* tests: first set of test fixes for uc24
* add details and 2 more fixes
* fix 2 more tests
* gix user-state test
* fix lp-1813365
* Add missing details
* fix listing test
this changes needs to be done like this until the os.query is-core-* is
fixed
* fix shellcheck
* fix merge saving jobs
* tests: initial changes to run core suite in uc24
Changes needed to run core test suite in uc24
* Squashed 'tests/lib/external/snapd-testing-tools/' changes from 1c8efb77e1..1db5214d5f
1db5214d5f Improve the remote docs (#36)
2e4a3153a2 1 more comment
3a0fc57e1e add explanation about why we check for ( Do | Doing )
4cf8e635bf fix os.query test after merge
b89b4f8647 fix artifacts name
d30cee6da0 Merge remote-tracking branch 'upstream/main'
5ef5dcbe8f Tests use artifacts in spread tests (#51)
555c43d2ab Support auto-refresh with Do instead of Doing
96c2b0c19c remove tests support for ubuntu 23.04 (EoL)
74082c0c34 Tests improve remote wait (#49)
5121bfb659 remove support for opensuse leap 15.4 (#48)
30df700d08 Add new systems support (#47)
1f08938925 Support check amazon linux version (#46)
43533bdd97 Change the exit value checking for test formats (#45)
3c88244c04 Update check-test-format to support a dir and a list of files (#44)
510d95f429 add extra check for error in auto-refresh detection function
3289d4031b Try open the log with latin-1 encoding when utf-8 is not working
9db785499f improved how the tools are waiting for system reboot
2a5c4414a3 fix shellcheck errors
5e7b63883d Fixes for osquery and tests pkgs (#43)
4c9145e2ac support reboot waiting for auto-refresh
45768f5188 show changes in unknown status after refresh
8013c30c2a Remove support for ubuntu 22.10
b32b80bf54 Fix remote.rait-for test in bionic
5675c625e9 Enable fedora 38
55f4471957 Support for new oss
f2e88b357c New tool used to query spread json reports
cacd35ede0 utils/spread-shellcheck: explain disabled warnings (#42)
c82afb2dee Support --no-install-recommends parameter when installing dependencies with tests.pkgs
b84eea92e2 spread-shellcheck: fix quotes in environment variables (#41)
ab1e51c29f New comparison in os-query for core systems (#40)
e5ae22a5d4 systemd units can be overwritten
63540b845a Fix error messages in remote pull and push
75e8a426a5 make sure the unit is removed in tests.systemd test
9089ff5c02 Update tests to use the new tests.systemd stop-unit
44ecd5e56a Move tests.systemd stop-units to stop-unit
01a2a83b4b Update tests.systemd to have stop units as systemd.sh
162e93bd35 update tests.systemd CLI options to be the same than retry command
14aa43a405 new feature to re-run failed spread tests (#39)
604cb782db Fix shellcheck in systemd tool
bfc71082c8 Update the tests.systemd to allow parameters waiting for service status
8a2d0a99df Adding quiet tool and removing set +-x from tests.pkgs
d90935d2a4 A comment explaining about the default values for wait-for
3232c5dba7 Add support for ubuntu 23.04
a7164fba07 remove fedora 35 support, add fedora 37 support
89b9eb5301 Update systems supported
92bb6a0664 Include snap-sufix in the snaps.name tool
git-subtree-dir: tests/lib/external/snapd-testing-tools
git-subtree-split: 1db5214d5fe91d90b4ffcd4768db8080fcc245ab
* fix core version under test
* adding missing model
* add missing function in nested.sh
* fix keys used for uc24
* Squashed 'tests/lib/external/snapd-testing-tools/' changes from 1db5214d5f..dacfd81de9
dacfd81de9 fix is_core functions
git-subtree-dir: tests/lib/external/snapd-testing-tools
git-subtree-split: dacfd81de95e05a9e56d84be45e0611275b083f4
* use pc-kernel from beta channel
* removing file created for workflow tests
* remove more dirs created during automatic merge
* restore perimssions for files in test snap-repair
* restore tools permissions merged incorrectly
* fix wording in test
* Squashed 'tests/lib/external/snapd-testing-tools/' changes from dacfd81de9..b89ec98b23
b89ec98b23 use local variables in os.query tool
git-subtree-dir: tests/lib/external/snapd-testing-tools
git-subtree-split: b89ec98b239dc9ef729b6af68ce1b5028b4eee23
* fix remove test details
* asserts: move aspect schema to assertion body
Move the aspect schema from a "storage" stanza to the assertion body.
Also format parse and re-encode the JSON with two spaces for indentation
and map ordered map keys. This should make the schema uniform and easy
to read while still using a format that can be emulated by other tools.
* many: nest schema in storage stanza
Signed-off-by: Miguel Pires <miguel.pires@canonical.com>
* asserts: support checking JSON body format
Signed-off-by: Miguel Pires <miguel.pires@canonical.com>
* asserts: improve err messages; move check
Signed-off-by: Miguel Pires <miguel.pires@canonical.com>
---------
Signed-off-by: Miguel Pires <miguel.pires@canonical.com>
* o/assertstate, o/devicestate: add more general function for fetching validation set assertions
* daemon, client: add API routes for creating/removing recovery system
* daemon, o/snapstate: add .snap file extension to snaps from forms
The seed writer will fail to consider files as snaps if their filenames
do not end in .snap.
* tests: test creating a recovery system
* tests: add spread test for offline creation of recovery system
* tests: update offline recovery system test to reboot into new system
* tests/nested/manual/recovery-system-reboot: add variants for factory-reset and install modes
* tests: replace usage of default-recovery-system with default-recovery
* o/devicestate: enable offline creation of recovery system entirely from pre-installed snaps
* daemon, client: test that offline API works without providing snaps or validation sets
* tests/nested/manual/recovery-system-offline: test offline remodel with only pre-installed snaps
* tests/nested/manual/recovery-system-reboot: modify test to create system with new set of essential snaps
* tests: disable shellcheck printf check
* daemon: rename functions for working with form values and add one for working with booleans
* daemon: acquire state lock later in postSystemActionCreateOffline
* daemon: cleanup form files if we fail to make change to create a recovery system
* daemon: rename parseValidationSets to assertionsFromValidationSetStrings for clarity
* client, daemon, tests: add "offline" field to create recovery system JSON api
* daemon: convert TODO about comma-delimited list into explanation of why we use a comma delimited list
* NEWS.md: add mention of create/remove recovery systems API
* tests/nested/manual/recovery-system-offline: explicitly disable network from nested vm
* tests/nested/manual/recovery-system-reboot: do not use new gadget in recovery system for now
* tests/lib/nested.sh: add variable NESTED_FORCE_MS_KEYS to force using microsoft keys
* tests/nested/manual/recovery-system-reboot: add back gadget snap swap to test
* tests/nested/manual/recovery-system-reboot: retry POST to remove since there might be an auto-refresh happening
* o/snapstatetest, o/devicestate, overlord: add param to InstallSnap and InstallEssentialSnaps for setting up gadget files
* o/devicestate: allow remodeling on hybrid models
When remodeling on a hybrid model, check to make sure that we have a
seed partition before creating a new recovery system as a part of the
remodel. Creating the new system is skipped if we don't see a seed
partition.
* tests/nested/manual/hybrid-remodel: new test for remodeling on a hybrid model
* o/snapstate/snapstatetest: forward gadget files to InstallSnap for gadget
* o/devicestate: add check for if the system is core-boot in undoCreateRecoverySystem
* gadget: add Info.HasRole method that checks for a role in an Info struct
* o/devicestate: replace manual role lookup with gadget.Info.HasRole incovation
* tests/nested/manual/hybrid-remodel: add TODO about testing system seeds on hybrid systems
* tests/nested/manual/hybrid-remodel: properly wait for reboot
* tests/nested/manual/hybrid-remodel: use change_id to make assertions more specific
* o/devicestate: do not attempt to finalize seed install when there is no seed partition
* tests: put muinstaller use into script for use in multiple tests
* o/devicestate: add comment explaining reason for explicitly checking classic systems
* tests: rename muinstaller.sh to setup_nested_hybrid_system.sh to clarify functionality
* tests/lib/tools/setup_nested_hybrid_system.sh: tell shellcheck where to find sourced files
* tests/lib/tools: rename --fake-disk to --disk in setup_nested_hybrid_system.sh
* tests/nested/manual/muinstaller-real: fix missing usage of $label variable in setup_nested_hybrid_system.sh
* tests/nested/manual/muinstaller-real: fix check for pre-existing gpt partition
* tests/nested/manual/muinstaller-real: use proper quoting on path with escaped chars
* o/aspectstate: use real aspect-bundle assertions
Get a local aspect-bundle assertion instead of using the mock. Move the
transaction creation into aspectstate since it now needs to use the real
schema from the assertion.
Signed-off-by: Miguel Pires <miguel.pires@canonical.com>
* tests: use aspect-bundle assertion in spread test
Signed-off-by: Miguel Pires <miguel.pires@canonical.com>
* o/aspectstate: remove unused mock aspect assertion
Signed-off-by: Miguel Pires <miguel.pires@canonical.com>
---------
Signed-off-by: Miguel Pires <miguel.pires@canonical.com>
* snap: fix doc string on SelfContainedSetPrereqTracker
* o/devicestate: make sure that snaps for pre-existing model are already installed in tests
* overlord: make sure that snaps for pre-existing model are already installed in tests
* overlord, o/devicestate: use SelfContainedSetPrereqTracker to track prereqs during remodel
* overlord, o/devicestate, o/s/snapstatetest: move common test helpers to snapstatetest
* snap: add SelfContainedSetPrereqTracker.Snaps method for getting all snaps tracked by tracker
* overlord, o/devicestate: prevent remodel to model with base that does not match gadget base
* tests, tests/core/remodel-base: update remodeling test to also swap gadget when swapping base
This PR makes remodels take into account revision constraints from validation sets on the new model. Additionally, snaps that are marked as invalid in validation sets are checked for in the model.
* a/snapasserts: add methods for extracting more information out of ValidationSets type
* o/assertstate: add ValidationSetsFromModel function for extracting a snapasserts.ValidationSets from an asserts.Model
* o/snapstate: prevent installing/updating a snap from a local file that does not match requested revision
* o/devicestate: consider validation sets during remodeling
* tests/nested/manual: add remodel test that downgrades a snap because of a validation set
* tests/nested/manual: add remodel test that fails to remodel because of an invalid snap in a validation set
* tests/nested/manual: extend offline remodel test to also include a validation set
* tests/lib/assertions: fix timestamps on assertions
* asserts: add Key method to ValidationSet and ModelValidationSet
* o/devicestate: use new Key methods
* o/devicestate: maybe enforce validation sets during doSetModel
* o/devicestate: add test for enforcing validation sets in doSetModel
* a/snapasserts: simplify TestCanBePresent with loop
* tests/lib/assertions: add bluez snap to offline remodel test
* o/devicestate: remove done TODO
* o/snapstate: if remodeling, do not install prereq if link-snap task is present
* tests/nested/manual/remodel-offline: extend test to verify that validation sets are accounted for
* Revert "o/snapstate: if remodeling, do not install prereq if link-snap task is present"
This reverts commit 57c7725a2513df51be7ac1c06c492aaed07a6e3b.
This change is independent and will be included in another PR.
* a/snapasserts: add methods for extracting more information out of ValidationSets type
* o/assertstate: add ValidationSetsFromModel function for extracting a snapasserts.ValidationSets from an asserts.Model
* o/devicestate: add test for ValidationSetsConflictError.Is
* a/snapasserts: move methods after New function
* a/snapasserts: add test for ValidationSets.Revisions to verify ValidationSetsConflictError is returned
* o/assertstate: change ValidationSetsFromModel to take in a DeviceContext, rather than a StoreService
* o/assertstate: rename ValidationSetsModelFlags to ValidationSetsModelOptions
* o/devicestate: add type to export_test to make testing simpler
* tests: add details to new spread tests
* asserts: rename ModelValidationSet.Key and ValidationSet.Key to .SequenceName and add unit tests for them
* o/snapstate: update snap revision mismatch error message to be more clear
* o/devicestate: introduce helper for setting ValidationSets on snapstate.RevisionOptions if Revision is set
* o/devicestate: verify the parameters that fakeSequenceStore receives
* o/devicestate: fix revisions not being respected for essential snaps (and add a test for it)
* o/devicestate: extend TestRemodelUC20EssentialSnapsAlreadyInstalledAndLocal to also exercise case where a validation set requires a revision but the currently installed version is unasserted
* s/seedtest: update retrieveSeq to handle unconstrained sequence forming assertions
* a/snapasserts: add ValidationSets.Sets method
* o/assertstate: add deviceContext to ForgetValidationSet function so that change can happen during remodel
* o/devicestate: attempt to handle rollback of validation sets during failed remodel
* overlord: test for replacing conflicting validation sets during remodel
* o/assertstate: update ForgetValidationSet to take in a DeviceContext and to allow for forcing removal even if the validation set is in use by the model
* o/devicestate: roll back validation set changes on remodel failure
* o/devicestate: make sure that validation sets unrelated to the model survive a remodel
* o/devicestate: rename param in installedSnapRevisionChanged
* o/devicestate: rename field newSnapRevision to newRequiredRevision in modelSnapsForRemodel
* o/devicestate: simplify loops in checkForInvalidSnapsInModel
* o/devicestate: compare validation sets using SequenceName methods
* o/devicestate: fail remodel if we attempt to use an unasserted snap as a specific revision
* tests/nested/manual/remodel-offline: fix test to actually use validation set
* o/devicestate: create helper for creating snapstate.RevisionOptions during remodel
* o/devicestate: name param literals for clarity
* o/devicestate: invert logic to eliminate double negative
* o/devicestate: fix missed inversion of logic
* o/assertstate: update comment on ForgetValidationSetOpts.ForceForget
* overlord, o/devicestate: update remodel test to change models that contain the same validation set
* o/assertstate: test ForceForget functionality in ForgetValidationSet
* o/devicestate: rename function newRevisionOptionsForRemodel to revisionOptionsForRemodel
* o/assertstate, o/devicestate, daemon: remove unneeded DeviceContext param from ForgetValidationSet
* o/devicestate: remove println
* o/devicestate: clarify comment in rollback of adding validation sets
* o/devicestate: rename variable in enforceValidationSetsForRemodel
* o/snapstate: clarify error when attempting to install/refresh local snap with different revision than requested
* o/devicestate: naming consistency
* o/devicestate: simplify error when model is missing snap that is required in validation set
* asserts, overlord, o/devicestate: rename SequenceName to SequenceKey and prefix the series to the string that is returned
* Tests support for ubuntu core 22 in arm architecture
This change includes the bits needed to run ubuntu-core in arm devices
and also the nested tests.
A new backend is added google-nested-arm.
Changes in tests to support the new system are also included.
* skip removing test-snapd-arm-tools
this is not needed anymore as focal is not being supported
* Use host machine for arch
* tests fixes
* skip nested arm xecution in github workflow
* New mkimage-uc22 tool
This new tool is used to build a classic ubuntu image with kernel,
gadget snapd and base snaps.
This script is based on the one stored in the
tests/nested/manual/fde-on-classic.
This change also includes a new spread test done to validate the tool.
The new tool has new parameters which make the process easy to run in
different scenarios.
* Fix shellcheck in the test
* update the task.yaml fields order
* Some minor changes to address review comments
* Update the gadget snap instead of using a harcoded one
* All the vars are local now and a cleanup functions was removed
* fix shellcheck
* o/devicestate: read system options when handling kernel command line
Use the kernel command line options when building the kernel command
line.
* tests: add cmdline-option test
cmdline-option checks that we can change the kernel command line using
the kernel system options.
* overlord: make task keys for the update cmdline task constants
* o/devicestate: export CurrentGadgetInfo so it can be used from configcore
* o/configcore: validate kernel command line against allow list
* o/devicestate: use the full string when looking for the kernel command
line options.
* tests/nested/manual/cmdline-option: run remotely all commands
* overlord: copy strings instead of using constants for task keys
Until some better way is found.
* gadget,overlord: change checking allowed parameters to a filter function
* o/devicestate: filter out unallowed arguments when building the kernel cmdline
Filter arguments not allowed by the gadget.
* gadget: name return params in FilterKernelCmdline and add test cases
* overlord: address review comments
* gadget,overlord: address review comments
The `tests/nested/manual/connections` is failing sometimes and
it's unclear why. When it fails it appears that the `connections`
snap is not installed which is strange given that it's clearly
needed in the model - as a consequence there are no connections
so the test fails.
To untangle this a bit this commit makes some changes to the test:
- rename to gadget-connections
- rename test snap from just "connections" to "tests-snapd-connections"
- rename the model from "pc" to "nested-20-amd64-test-snapd-connections"
- precondition checks that ensure we have the right model
- precondition checks that we have the expected test-snapd-connections
snap
- move image building into "execute:" to ensure that on failure we get
the shell log of how the image was build (this is lost if "prepare"
bulds the image but the error happens in "execute").