File: task.yaml

package info (click to toggle)
snapd 2.72-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 80,412 kB
  • sloc: sh: 16,506; ansic: 16,211; python: 11,213; makefile: 1,919; exp: 190; awk: 58; xml: 22
file content (75 lines) | stat: -rw-r--r-- 3,425 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
summary: Test sideloading components

details: |
  Verifies that we can sideload asserted components, and that we cannot sideload
  unasserted components without using the --dangerous flag.

systems: [ubuntu-16.04-64, ubuntu-18.04-64, ubuntu-2*, ubuntu-core-*, fedora-*]

execute: |
  snap install test-snap-with-components+one+two

  cp /var/lib/snapd/snaps/test-snap-with-components+one*.comp test-snap-with-components+one.comp
  cp /var/lib/snapd/snaps/test-snap-with-components+two*.comp test-snap-with-components+two.comp
  cp /var/lib/snapd/snaps/test-snap-with-components*.snap test-snap-with-components.snap

  # TODO:COMPS: make this test simpler once "snap download" for components is
  # merged.

  # TODO:COMPS: add usage of the --component-ref flag to this test once it is
  # merged.

  # remove the components, but the assertions will stay around. we should be able
  # to sideload the components again.
  snap remove test-snap-with-components+one
  snap remove test-snap-with-components+two

  snap install ./test-snap-with-components+one.comp
  snap components test-snap-with-components | MATCH "test-snap-with-components\+one\s+installed\s+test"

  snap remove test-snap-with-components+one

  # remove the assertions manually this time, we should not be able to sideload
  # the component again.
  rm -r /var/lib/snapd/assertions/asserts-v0/snap-resource-pair \
        /var/lib/snapd/assertions/asserts-v0/snap-resource-revision

  not snap install ./test-snap-with-components+one.comp 2>&1 | tr '\n' ' ' | MATCH 'cannot find signatures with metadata for snap/component\s+"\./test-snap-with-components\+one.comp"'

  # and we also can't use the --dangerous flag, since the snap is asserted.
  not snap install --dangerous ./test-snap-with-components+one.comp 2>&1 | tr '\n' ' ' | MATCH 'cannot install component file: cannot mix asserted snap and unasserted\s+components'

  # make sure all the assertions are there again
  snap install test-snap-with-components+one+two
  snap remove test-snap-with-components

  # now try installing a mix snaps and components, all asserted

  snap download hello-world --basename hello-world
  snap ack ./hello-world.assert

  snap install ./hello-world.snap \
    ./test-snap-with-components+one.comp \
    ./test-snap-with-components+two.comp \
    ./test-snap-with-components.snap

  snap list hello-world
  snap list test-snap-with-components
  snap components test-snap-with-components | MATCH "test-snap-with-components\+one\s+installed\s+test"
  snap components test-snap-with-components | MATCH "test-snap-with-components\+two\s+installed\s+test"

  snap remove hello-world test-snap-with-components

  # should fail, since we're missing the snap that these components are
  # associated with
  not snap install ./hello-world.snap \
    ./test-snap-with-components+one.comp \
    ./test-snap-with-components+two.comp 2>&1 | tr '\n' ' ' | tr -s ' ' | MATCH 'error: snap owning "test-snap-with-components\+one" is neither installed nor provided to sideload'

  snap install ./test-snap-with-components.snap

  # should work, since the snap is now already installed
  snap install ./test-snap-with-components+one.comp ./test-snap-with-components+two.comp

  snap components test-snap-with-components | MATCH "test-snap-with-components\+one\s+installed\s+test"
  snap components test-snap-with-components | MATCH "test-snap-with-components\+two\s+installed\s+test"