File: task.yaml

package info (click to toggle)
snapd 2.71-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 79,536 kB
  • sloc: ansic: 16,114; sh: 16,105; python: 9,941; makefile: 1,890; exp: 190; awk: 40; xml: 22
file content (60 lines) | stat: -rw-r--r-- 1,985 bytes parent folder | download | duplicates (2)
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
summary: Verify that snapd can undo the upgrade from non-snapd-snap to snapd-snap

details: |
  Verify that the snapd-snap can successfully undo after upgrading from a non snapd-snap
  situation, and something causes a rollback even in spite of a successful snapd update.

# UC16 still uses the core snap rather than the snapd snap, so disable this test
# for UC16
systems: [-ubuntu-core-16-*]

environment:
  SNAP_NAME_BAD: test-snapd-service-v2-bad

restore: |
  # Remove all inactive revisions of snapd.
  current=$(readlink /snap/snapd/current)
  for revno_path in /snap/snapd/*; do
    revno=$(basename "$revno_path")
    if [ "$revno" == current ] || [ "$revno" == "$current" ]; then
      continue
    fi
    snap remove snapd --revision="$revno"
  done

execute: |
  snap pack "$TESTSLIB/snaps/$SNAP_NAME_BAD"

  # store a copy of the built snapd
  if [ -e /var/lib/snapd/snaps/snapd_x1.snap ]; then
    cp /var/lib/snapd/snaps/snapd_x1.snap ./snapd.snap
  else
    # Beta validation has a different snapd version
    cp /var/lib/snapd/snaps/snapd_*.snap ./snapd.snap
  fi

  revision=""
  if os.query is-arm64; then
    revision=18363
  elif os.query is-armhf; then
    revision=18359
  else
    revision=18357
  fi

  # refresh to a snapd prior to snapd snap, this one is chosen from
  # a customer case where they were seeing issues with snapd reverting
  snap refresh snapd --amend --revision="$revision"
  snap list | MATCH "snapd.*$revision"

  # perform a refresh to the current snapd, this will fail, do it in a way
  # that will make snapd revert
  CHG_ID=$(snap install --no-wait --dangerous --transaction=all-snaps ./snapd.snap ./test-snapd-service_2.0_all.snap)
  snap watch "$CHG_ID" || true

  # verify this has no undo failures for snapd related to security profiles
  snap change "$CHG_ID" | MATCH "(Undone).*Setup snap \"snapd\" \(unset\) security profiles"
  snap change "$CHG_ID" | grep -c "Error" | MATCH "1"

  # restore original snapd
  snap revert snapd