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 (37 lines) | stat: -rw-r--r-- 1,677 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
summary: Ensure that old experimental flag configs are hidden

details: |
    Check that experimental flag configs that used to exist but now
    are out of experimental are hidden unless specifically referenced
    and their values will be retained to ensure it works as before in
    case of revert to previous snapd version.

prepare: |
    snap install --devmode jq

restore: |
    snap remove jq

execute: |
    echo "Check that users cannot set unsupported experimental features"
    snap set core experimental.old-flag=true 2>&1 | MATCH "unsupported system option"
    snap get core experimental.old-flag | NOMATCH "true"

    # Stop snapd while editing state.json manually
    systemctl stop snapd.service snapd.socket

    echo "Force setting the unsupported experimental.old-flag"
    # This simulates the situation where an experimental feature got out
    # of experimental after a snapd refresh and now is an unsupported config
    jq '.data.config.core.experimental += {"old-flag": true}' /var/lib/snapd/state.json > state.json
    mv state.json /var/lib/snapd/state.json
    echo "Check that experimental.old-flag is persisted in state.json"
    jq '.data.config.core.experimental."old-flag"' /var/lib/snapd/state.json | MATCH "true"

    systemctl start snapd.service snapd.socket
    echo "Old experimental flags are hidden in generic queries"
    snap get core experimental | NOMATCH "old-flag"
    echo "But not removed for exact queries"
    snap get core experimental.old-flag | MATCH "true"
    echo "Also, old flag is not removed from state in case of a revert"
    jq '.data.config.core.experimental."old-flag"' /var/lib/snapd/state.json | MATCH "true"