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 (51 lines) | stat: -rw-r--r-- 1,742 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
summary: Check that `snap auto-import` works as expected

details: |
    The auto-import command searches available mounted devices looking for
    assertions that are signed by trusted authorities, and potentially
    performs system changes based on them.

    Assertions to be imported must be made available in the auto-import.assert file
    in the root of the filesystem.

    Having created a ramdisk with the account-key assertion, this test verifies that
    an account key can be imported by the `snap auto-import` command from the
    mounted ramdisk. 

systems: [ubuntu-core-*-64]

prepare: |
    if [ "$TRUST_TEST_KEYS" = "false" ]; then
        echo "This test needs test keys to be trusted"
        exit
    fi
    echo "Ensure the testrootorg-store.account-key is not already added"
    output=$(snap known account-key | grep -c "name: test-store" || true)
    if [ "$output" != "0" ]; then
            echo " testrootorg-store.account-key is already added"
            exit 1
    fi
    echo "Create a ramdisk with the testrootorg-store.account-key assertion"
    #shellcheck source=tests/lib/ramdisk.sh
    . "$TESTSLIB/ramdisk.sh"
    setup_ramdisk
    mkfs.ext3 /dev/ram0
    mount /dev/ram0 /mnt
    cp "$TESTSLIB"/assertions/testrootorg-store.account-key /mnt/auto-import.assert
    sync

restore: |
    if [ "$TRUST_TEST_KEYS" = "false" ]; then
        echo "This test needs test keys to be trusted"
        exit
    fi
    umount /mnt

execute: |
    if [ "$TRUST_TEST_KEYS" = "false" ]; then
        echo "This test needs test keys to be trusted"
        exit
    fi
    echo "$(snap auto-import) imports assertions from the mounted ramdisk"
    snap auto-import
    snap known account-key | MATCH "name: test-store"