~snappy-dev/snappy/15.04

« back to all changes in this revision

Viewing changes to _integration-tests/tests/info_test.go

  • Committer: Snappy Tarmac
  • Author(s): John R. Lenton, Michael Vogt, Leo Arias, Launchpad Translations on behalf of snappy-dev, Federico Gimenez, Ricardo Mendoza
  • Date: 2015-10-13 06:03:57 UTC
  • mfrom: (711.1.54 snappy)
  • Revision ID: snappy_tarmac-20151013060357-rf1cz6y7190uzzlr
Merge trunk fixes. by snappy-dev approved by chipaca

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 
22
22
import (
23
23
        "fmt"
24
 
 
25
 
        . "launchpad.net/snappy/_integration-tests/testutils/common"
26
 
 
27
 
        check "gopkg.in/check.v1"
 
24
        "os"
 
25
 
 
26
        "launchpad.net/snappy/_integration-tests/testutils/build"
 
27
        "launchpad.net/snappy/_integration-tests/testutils/cli"
 
28
        "launchpad.net/snappy/_integration-tests/testutils/common"
 
29
 
 
30
        "gopkg.in/check.v1"
28
31
)
29
32
 
30
33
var _ = check.Suite(&infoSuite{})
31
34
 
32
35
type infoSuite struct {
33
 
        SnappySuite
 
36
        common.SnappySuite
34
37
}
35
38
 
36
39
func (s *infoSuite) TestInfoMustPrintReleaseAndChannel(c *check.C) {
37
40
        // skip test when having a remote testbed (we can't know which the
38
41
        // release and channels are)
39
 
        if Cfg.RemoteTestbed {
 
42
        if common.Cfg.RemoteTestbed {
40
43
                c.Skip(fmt.Sprintf(
41
44
                        "Skipping %s while testing in remote testbed",
42
45
                        c.TestName()))
43
46
        }
44
47
 
45
 
        infoOutput := ExecCommand(c, "snappy", "info")
 
48
        infoOutput := cli.ExecCommand(c, "snappy", "info")
46
49
 
47
50
        expected := "(?ms)" +
48
 
                fmt.Sprintf("^release: ubuntu-core/%s/%s\n", Cfg.Release, Cfg.Channel) +
 
51
                fmt.Sprintf("^release: ubuntu-core/%s/%s\n", common.Cfg.Release, common.Cfg.Channel) +
49
52
                ".*"
50
53
 
51
54
        c.Assert(infoOutput, check.Matches, expected)
52
55
}
53
56
 
54
57
func (s *infoSuite) TestInfoMustPrintInstalledApps(c *check.C) {
55
 
        InstallSnap(c, "hello-world")
56
 
        s.AddCleanup(func() {
57
 
                RemoveSnap(c, "hello-world")
58
 
        })
59
 
        infoOutput := ExecCommand(c, "snappy", "info")
 
58
        snapPath, err := build.LocalSnap(c, build.BasicSnapName)
 
59
        defer os.Remove(snapPath)
 
60
        c.Assert(err, check.IsNil)
 
61
        common.InstallSnap(c, snapPath)
 
62
        defer common.RemoveSnap(c, build.BasicSnapName)
 
63
 
 
64
        infoOutput := cli.ExecCommand(c, "snappy", "info")
60
65
 
61
66
        expected := "(?ms)" +
62
67
                ".*" +
63
 
                "^apps: .*hello-world.*\n"
 
68
                "^apps: .*" + build.BasicSnapName + "\\.sideload.*\n"
64
69
        c.Assert(infoOutput, check.Matches, expected)
65
70
}
66
71
 
67
72
func (s *infoSuite) TestInfoMustPrintInstalledFrameworks(c *check.C) {
68
 
        InstallSnap(c, "hello-dbus-fwk.canonical")
 
73
        common.InstallSnap(c, "hello-dbus-fwk.canonical")
69
74
        s.AddCleanup(func() {
70
 
                RemoveSnap(c, "hello-dbus-fwk.canonical")
 
75
                common.RemoveSnap(c, "hello-dbus-fwk.canonical")
71
76
        })
72
 
        infoOutput := ExecCommand(c, "snappy", "info")
 
77
        infoOutput := cli.ExecCommand(c, "snappy", "info")
73
78
 
74
79
        expected := "(?ms)" +
75
80
                ".*" +