606 Commits

Author SHA1 Message Date
Michael Vogt
d86ef5f21e Merge pull request #11407 from anonymouse64/bugfix/vuln-spread-tests-tweaks
tests: small adjustments to fix vuln spread tests
2022-03-04 09:26:10 +01:00
Maciej Borzecki
c63da6262a tests/nested/core/core20-reinstall-partitions: update test summary
Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2022-03-03 10:25:17 +01:00
Alberto Mardegan
34fccfdeb9 interfaces: custom-device
* i/b/custom_device: add new custom-device interface

* tests: spread tests for the custom-device interface

* tests: remove unused variable

* tests: add custom-device plug to interfaces-many-core-provided

* i/b/custom-device: fix base declaration

* i/b/custom-devices: error reporting, pattern handling

* i/b/custom_device: add unit test for ** check

* i/b/custom_device: add support for read-devices attribute

* i/b/custom_device: revert change on ** in paths

It's safer to be restrictive and keep the globbing to "*".

* i/b/custom_device: update comment on AppArmor globbing

* i/b/custom_device: minor formatting change

* i/b/custom_device: improve logic of slot attribute naming

* i/b/custom_device_test: add tests

* i/b/custom_device: update interface declaration

* interfaces/custom-device: mv read/write under a files key

As suggested by Samuele. Also update all the tests.

Signed-off-by: Ian Johnson <ian.johnson@canonical.com>

* i/b/custom_device: remove leftover comments

* i/b/custom_device: remove unneeded function parameter

* i/b/custom-devices: improve validation, error handling and tests

* i/b/custom_device: test more invalid characters

Co-authored-by: Michael Vogt <mvo@ubuntu.com>
Co-authored-by: Ian Johnson <ian.johnson@canonical.com>
2022-03-02 16:52:43 +01:00
Ian Johnson
cb9be3d590 tests: rm downloaded snaps
Currently, when tests/nested/manual/devmode-snaps-can-run-other-snaps runs, it
can sometimes fail because the core.snap in the specified directory still
exists and is incompatible with being able to build the project directory as a
snapcraft snap, so removing it here should prevent this cross-device link from
failing the build:

```
Pulling snapd-deb
+ snapcraftctl pull
[Errno 13] Permission denied: '/root/project/tests/nested/core/core-snap-refresh-on-core/core.snap'
Traceback (most recent call last):
  File "/snap/snapcraft/6512/lib/python3.6/site-packages/snapcraft/file_utils.py", line 105, in link_or_copy
    link(source, destination, follow_symlinks=follow_symlinks)
  File "/snap/snapcraft/6512/lib/python3.6/site-packages/snapcraft/file_utils.py", line 139, in link
    os.link(source_path, destination, follow_symlinks=False)
OSError: [Errno 18] Invalid cross-device link: '/root/project/tests/nested/core/core-snap-refresh-on-core/core.snap' -> '/root/parts/snapd-deb/src/tests/nested/core/core-snap-refresh-on-core/core.snap'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/snap/snapcraft/6512/bin/snapcraft", line 33, in <module>
    sys.exit(load_entry_point('snapcraft==4.8', 'console_scripts', 'snapcraft')())
  File "/snap/snapcraft/6512/lib/python3.6/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/snap/snapcraft/6512/lib/python3.6/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/snap/snapcraft/6512/lib/python3.6/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/snap/snapcraft/6512/lib/python3.6/site-packages/snapcraft/cli/_command.py", line 81, in invoke
    return super().invoke(ctx)
  File "/snap/snapcraft/6512/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/snap/snapcraft/6512/lib/python3.6/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/snap/snapcraft/6512/lib/python3.6/site-packages/snapcraft/cli/lifecycle.py", line 388, in snap
    _execute(steps.PRIME, parts=tuple(), pack_project=True, output=output, **kwargs)
  File "/snap/snapcraft/6512/lib/python3.6/site-packages/snapcraft/cli/lifecycle.py", line 103, in _execute
    lifecycle.execute(step, project_config, parts)
  File "/snap/snapcraft/6512/lib/python3.6/site-packages/snapcraft/internal/lifecycle/_runner.py", line 137, in execute
    executor.run(step, part_names)
  File "/snap/snapcraft/6512/lib/python3.6/site-packages/snapcraft/internal/lifecycle/_runner.py", line 191, in run
    self._handle_step(part_names, part, step, current_step, cli_config)
  File "/snap/snapcraft/6512/lib/python3.6/site-packages/snapcraft/internal/lifecycle/_runner.py", line 205, in _handle_step
    getattr(self, "_run_{}".format(current_step.name))(part)
  File "/snap/snapcraft/6512/lib/python3.6/site-packages/snapcraft/internal/lifecycle/_runner.py", line 247, in _run_pull
    self._run_step(step=steps.PULL, part=part, progress="Pulling")
  File "/snap/snapcraft/6512/lib/python3.6/site-packages/snapcraft/internal/lifecycle/_runner.py", line 325, in _run_step
    getattr(part, step.name)()
  File "/snap/snapcraft/6512/lib/python3.6/site-packages/snapcraft/internal/pluginhandler/__init__.py", line 487, in pull
    self._do_runner_step(steps.PULL)
  File "/snap/snapcraft/6512/lib/python3.6/site-packages/snapcraft/internal/pluginhandler/__init__.py", line 280, in _do_runner_step
    return getattr(self._runner, "{}".format(step.name))()
  File "/snap/snapcraft/6512/lib/python3.6/site-packages/snapcraft/internal/pluginhandler/_runner.py", line 85, in pull
    steps.PULL,
  File "/snap/snapcraft/6512/lib/python3.6/site-packages/snapcraft/internal/pluginhandler/_runner.py", line 189, in _run_scriptlet
    raise error
  File "/snap/snapcraft/6512/lib/python3.6/site-packages/snapcraft/internal/pluginhandler/_runner.py", line 179, in _run_scriptlet
    scriptlet_name, function_call.strip()
  File "/snap/snapcraft/6512/lib/python3.6/site-packages/snapcraft/internal/pluginhandler/_runner.py", line 233, in _handle_builtin_function
    function(**function_args)
  File "/snap/snapcraft/6512/lib/python3.6/site-packages/snapcraft/internal/pluginhandler/__init__.py", line 507, in _do_pull
    self.source_handler.pull()
  File "/snap/snapcraft/6512/lib/python3.6/site-packages/snapcraft/internal/sources/_local.py", line 41, in pull
    copy_function=self.copy_function,
  File "/snap/snapcraft/6512/lib/python3.6/site-packages/snapcraft/file_utils.py", line 248, in link_or_copy_tree
    copy_function(source, destination)
  File "/snap/snapcraft/6512/lib/python3.6/site-packages/snapcraft/file_utils.py", line 113, in link_or_copy
    copy(source, destination, follow_symlinks=follow_symlinks)
  File "/snap/snapcraft/6512/lib/python3.6/site-packages/snapcraft/file_utils.py", line 162, in copy
    shutil.copy2(source, destination, follow_symlinks=follow_symlinks)
  File "/snap/snapcraft/6512/usr/lib/python3.6/shutil.py", line 263, in copy2
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "/snap/snapcraft/6512/usr/lib/python3.6/shutil.py", line 120, in copyfile
    with open(src, 'rb') as fsrc:
PermissionError: [Errno 13] Permission denied: '/root/project/tests/nested/core/core-snap-refresh-on-core/core.snap'
Run the same command again with --debug to shell into the environment if you wish to introspect this failure.
-----
```

Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
2022-02-23 05:33:28 -06:00
Ian Johnson
90774f0344 tests/nested/snapd-removes-vulnerable-snap-confine-revs: use newer snaps
This reduces the delta between what we are refreshing to and may reduce some
flakiness in the test (if there is any).

Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
2022-02-17 11:19:07 -06:00
Ian Johnson
f3f669d720 Merge remote-tracking branch 'mvo5-private/release-2.54.3'
Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
2022-02-17 11:13:00 -06:00
Michael Vogt
3abb4089f4 snapstate: use version number to differentiate vulnerable versions 2022-02-15 12:01:44 +01:00
Ian Johnson
3f3432b0f1 tests/nested/manual: add spread test to confirm we remove vulnerable revisions
Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
2022-02-15 12:01:44 +01:00
Ian Johnson
36c3a314ef tests/nested/manual/core20-cloud-init-maas-signed-seed-data: add gadget variant (#10807)
* tests/nested/manual/core20-cloud-init-maas-signed-seed-data: add gadget variant

Add variants for the gadget snap having cloud.conf that allows MAAS and a
cloud.conf which disallows any datasource in it.

Also add an unrelated datasource file to ubuntu-seed always that gets ignored
since it is for a currently unsupported datasource (GCE).
2022-02-10 14:44:06 -06:00
Ian Johnson
2ff66d0467 tests/nested/manual/devmode-snaps-can-run-other-snaps: implement test
Add a spread test for the various test cases of executing other snaps from a
devmode snap for UC16 and UC18 with the various permutations.

Signed-off-by: Ian Johnson <ian.johnson@canonical.com>

tests/nested/manual/devmode-snaps-can-run-other-snaps:
- use pipe to run umask command
- add missing snap install in bionic part
- add missing install for BASE_CORE_STRICT_SNAP
- simplify profile (re)generation

Signed-off-by: Michael Vogt <michael.vogt@canonical.com>
2022-02-09 18:10:22 +01:00
Michael Vogt
546e15c6fa tests: add nested spread test that devmode snaps can be seeded
This adds a missing integration test that ensures that a devmode
snap can be seeded during firstboot.
2022-02-09 18:08:50 +01:00
Maciej Borzecki
a8028e00ef tests/nested/manual/remodel-cross-store,remodel-simple: wait for serial
Wait for serial before querying for it and proceeding with remodel.

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2022-02-04 19:20:01 +01:00
Pawel Stolowski
7d10492fc3 tests: ensure that interface hook works with hotplug plug
* Ensure that interface hook works with hotplug plug.

* Newline
2022-02-01 12:30:15 +01:00
Michael Vogt
619360aaee Merge pull request #11277 from bboozzoo/bboozzoo/test-snapd-remodel-cross-store
tests: cross store remodel
2022-01-24 14:57:09 +01:00
Maciej Borzecki
06c2794c0e tests/nested/manual/remodel-cross-store: check tweaks, formatting
Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2022-01-24 12:06:55 +01:00
Michael Vogt
4e015355b4 Merge pull request #10752 from mvo5/netplan-read-write
configcore: implement netplan write support via dbus
2022-01-21 10:58:10 +01:00
Maciej Borzecki
365caecf6b tests/nested/manual/remodel-cross-store: add details about the test
Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2022-01-21 08:06:15 +01:00
Maciej Borzecki
72b30dc658 Merge remote-tracking branch 'upstream/master' into bboozzoo/test-snapd-remodel-cross-store 2022-01-21 07:57:34 +01:00
Maciej Borzecki
00b57f674e tests/nested/manual/remodel-cross-store: drop exclamation mark, as shell is hard
Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2022-01-20 14:38:09 +01:00
Maciej Borzecki
d34904fdc5 tests/nested/manual: set the serial suitable for cross store remodel
Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2022-01-20 14:20:11 +01:00
Maciej Borzecki
a0c8db19ca tests/nested/manual/remodel-simple: set the serial suitable for the remodel scenario
Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2022-01-20 14:19:51 +01:00
Maciej Borzecki
38d581be6a tests/nested/manual/remodel-simple: provide test description, tweak comments
Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2022-01-20 12:43:17 +01:00
Maciej Borzecki
e5a9f4484a tests/nested/manual/remodel-simple: also verify the store IDs
Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2022-01-20 11:51:42 +01:00
Maciej Borzecki
42cbbd7edd tests/nested/manual/remodel-cross-store: cross store remodel test
Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2022-01-20 09:52:23 +01:00
Maciej Borzecki
d92d7d6323 tests/nested/manual/remodel-simple: also verify the store IDs
Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2022-01-20 09:51:53 +01:00