Merge lp:~elopio/snappy/skip_fan into lp:~snappy-dev/snappy/snappy-moved-to-github

Proposed by Leo Arias
Status: Merged
Approved by: Federico Gimenez
Approved revision: 716
Merged at revision: 719
Proposed branch: lp:~elopio/snappy/skip_fan
Merge into: lp:~snappy-dev/snappy/snappy-moved-to-github
Diff against target: 141 lines (+109/-1)
4 files modified
_integration-tests/tests/ubuntuFan_test.go (+4/-0)
_integration-tests/testutils/common/common.go (+1/-1)
_integration-tests/testutils/common/info.go (+46/-0)
_integration-tests/testutils/common/info_test.go (+58/-0)
To merge this branch: bzr merge lp:~elopio/snappy/skip_fan
Reviewer Review Type Date Requested Status
Federico Gimenez (community) Approve
Review via email: mp+272312@code.launchpad.net

Commit message

Skip the ubuntu fan tests in 15.04.

Description of the change

I didn't use the release value from Cfg because when we pass an ip to the test, that value is not accurate.

To post a comment you must log in.
lp:~elopio/snappy/skip_fan updated
716. By Leo Arias

Fmt.

Revision history for this message
Federico Gimenez (fgimenez) wrote :

Nicely done, thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file '_integration-tests/tests/ubuntuFan_test.go'
--- _integration-tests/tests/ubuntuFan_test.go 2015-09-10 10:15:43 +0000
+++ _integration-tests/tests/ubuntuFan_test.go 2015-09-24 21:06:13 +0000
@@ -45,6 +45,10 @@
45}45}
4646
47func (s *fanTestSuite) SetUpTest(c *check.C) {47func (s *fanTestSuite) SetUpTest(c *check.C) {
48 if common.Release(c) == "15.04" {
49 c.Skip("Ubuntu Fan not available in 15.04")
50 }
51
48 s.SnappySuite.SetUpTest(c)52 s.SnappySuite.SetUpTest(c)
49 var err error53 var err error
50 s.subjectIP, err = getIPAddr(c)54 s.subjectIP, err = getIPAddr(c)
5155
=== modified file '_integration-tests/testutils/common/common.go'
--- _integration-tests/testutils/common/common.go 2015-09-03 10:46:21 +0000
+++ _integration-tests/testutils/common/common.go 2015-09-24 21:06:13 +0000
@@ -29,7 +29,7 @@
29 "strconv"29 "strconv"
30 "strings"30 "strings"
3131
32 check "gopkg.in/check.v1"32 "gopkg.in/check.v1"
3333
34 "launchpad.net/snappy/_integration-tests/testutils/config"34 "launchpad.net/snappy/_integration-tests/testutils/config"
35)35)
3636
=== added file '_integration-tests/testutils/common/info.go'
--- _integration-tests/testutils/common/info.go 1970-01-01 00:00:00 +0000
+++ _integration-tests/testutils/common/info.go 2015-09-24 21:06:13 +0000
@@ -0,0 +1,46 @@
1// -*- Mode: Go; indent-tabs-mode: t -*-
2
3/*
4 * Copyright (C) 2015 Canonical Ltd
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 3 as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 *
18 */
19
20package common
21
22import (
23 "bufio"
24 "strings"
25
26 "gopkg.in/check.v1"
27)
28
29// dependency aliasing
30var execCommand = ExecCommand
31
32// Release returns the release of the current snappy image
33func Release(c *check.C) string {
34 info := execCommand(c, "snappy", "info")
35 reader := strings.NewReader(info)
36 scanner := bufio.NewScanner(reader)
37 for scanner.Scan() {
38 if strings.HasPrefix(scanner.Text(), "release: ") {
39 releaseInfo := strings.TrimPrefix(scanner.Text(), "release: ")
40 return strings.Split(releaseInfo, "/")[1]
41 }
42 }
43 c.Error("Release information not found")
44 c.FailNow()
45 return ""
46}
047
=== added file '_integration-tests/testutils/common/info_test.go'
--- _integration-tests/testutils/common/info_test.go 1970-01-01 00:00:00 +0000
+++ _integration-tests/testutils/common/info_test.go 2015-09-24 21:06:13 +0000
@@ -0,0 +1,58 @@
1// -*- Mode: Go; indent-tabs-mode: t -*-
2
3/*
4 * Copyright (C) 2014-2015 Canonical Ltd
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 3 as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 *
18 */
19
20package common
21
22import "gopkg.in/check.v1"
23
24type infoTestSuite struct {
25 execReturnValue string
26 backExecCommand func(*check.C, ...string) string
27}
28
29var _ = check.Suite(&infoTestSuite{})
30
31func (s *infoTestSuite) SetUpSuite(c *check.C) {
32 s.backExecCommand = execCommand
33 execCommand = s.fakeExecCommand
34}
35
36func (s *infoTestSuite) TearDownSuite(c *check.C) {
37 execCommand = s.backExecCommand
38}
39
40func (s *infoTestSuite) fakeExecCommand(c *check.C, args ...string) (output string) {
41 return s.execReturnValue
42}
43
44var releaseTests = []struct {
45 infoOutput string
46 expectedRelease string
47}{
48 {"someInfo1: someValue1\nrelease: ubuntu-core/15.04/edge\nsomeInfo2: someValue2", "15.04"},
49 {"someInfo1: someValue1\nrelease: ubuntu-core/rolling/alpha\nsomeInfo2: someValue2", "rolling"},
50}
51
52func (s *infoTestSuite) TestRelease(c *check.C) {
53 for _, t := range releaseTests {
54 s.execReturnValue = t.infoOutput
55 release := Release(c)
56 c.Assert(release, check.Equals, t.expectedRelease, check.Commentf("Wrong release"))
57 }
58}

Subscribers

People subscribed via source and target branches