~sergiusens/snappy/tools-parted

« back to all changes in this revision

Viewing changes to _integration-tests/tests/90_test_upgrade

  • Committer: Sergio Schvezov
  • Date: 2015-07-30 18:46:22 UTC
  • mfrom: (576.1.1 tools-grub)
  • Revision ID: sergio.schvezov@canonical.com-20150730184622-mga36e3aevz09qw5
Merged tools-grub into tools-parted.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Test that we can upgrade to the latest image version and roll back to the
2
 
# original version. Test will be skipped the testbed does not offer reboot
3
 
# (needs autopkgtest with a supporting runner).
4
 
 
5
 
test() {
6
 
    can_reboot || { echo "SKIP: cannot reboot testbed"; return; }
7
 
 
8
 
    # debug
9
 
    version_info    
10
 
    boot_info
11
 
 
12
 
    if after_reboot; then
13
 
        # second reboot: after rollback
14
 
        if [ -e "${ADT_ARTIFACTS}/rolled_back" ]; then
15
 
            orig_current=$(cat "${ADT_ARTIFACTS}/current")
16
 
            [ "$orig_current" = "$current" ] || fail "did not roll back to version $orig_current ($all_versions)"
17
 
            return
18
 
        fi
19
 
 
20
 
        # first reboot: after upgrade
21
 
        orig_avail=$(cat "${ADT_ARTIFACTS}/avail")
22
 
        [ "$orig_avail" = "$current" ] || fail "did not upgrade to current version $orig_avail != $current ($all_versions)"
23
 
 
24
 
        echo "rolling back..."
25
 
        sudo snappy rollback ubuntu-core
26
 
        touch "${ADT_ARTIFACTS}/rolled_back"
27
 
        reboot
28
 
        return
29
 
    fi
30
 
 
31
 
    # fake new available version by doing a current--
32
 
    switch_channel "s/build_number: $current/build_number: $((current-1))/"
33
 
 
34
 
    # we should have something now :)
35
 
    version_info
36
 
    
37
 
    [ $avail -gt $current ] || fail "$avail is not newer than $current"
38
 
 
39
 
    # save version for post-upgrade test
40
 
    save_version_info $avail $current    
41
 
 
42
 
    echo "upgrading..."
43
 
    sudo snappy update
44
 
    reboot
45
 
}