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 (44 lines) | stat: -rw-r--r-- 1,700 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
summary: Check the debug command migrate-home migrates snaps' homes

details: |
  The `snap debug migrate-home` command can be used to migrate snaps'
  directory to ~/Snap. This test verifies that a snap with home in
  $HOME/foo is migrated to "$HOME"/Snap, and the snap's environment
  variables and AppArmor rules are correct after the migration.

prepare: |
  "$TESTSTOOLS"/snaps-state install-local "test-snapd-tools"
  "$TESTSTOOLS"/snaps-state install-local basic

restore: |
  snap unset system experimental.move-snap-home-dir
  snap remove --purge basic
  snap remove --purge test-snapd-tools

execute: |
  echo "Check that migrate home doesn't work without setting the experimental flag"
  if got=$(snap debug migrate-home test-snapd-tools 2>&1); then
    echo 'Calling "snap debug migrate-home" without setting "experimental.move-snap-home-dir" should fail'
    exit 1
  fi
  #shellcheck disable=SC2086
  echo $got |  MATCH 'error: cannot migrate to ~/Snap: flag "experimental.move-snap-home-dir" is not set'

  echo "Check that migrate home migrates the data under SNAP_USER_DATA"
  snap set system experimental.move-snap-home-dir=true

  #shellcheck disable=SC2016
  test-snapd-tools.cmd sh -c 'echo foo > $HOME/foo'
  MATCH "foo" < "$HOME/snap/test-snapd-tools/current/foo"
  not test -e "$HOME"/Snap

  snap debug migrate-home test-snapd-tools basic

  MATCH "foo" < "$HOME/Snap/test-snapd-tools/foo"

  echo "Check that the snap's environment variables and AppArmor rules are correct"
  test-snapd-tools.env | MATCH "HOME=$HOME/Snap/test-snapd-tools"

  #shellcheck disable=SC2016
  test-snapd-tools.cmd sh -c 'echo "bar" > $HOME/bar'
  MATCH "bar" < "$HOME/Snap/test-snapd-tools/bar"