Merge lp:~fgimenez/snappy/fix-failover-versions into lp:~snappy-dev/snappy/snappy-moved-to-github

Proposed by Federico Gimenez on 2015-07-03
Status: Superseded
Proposed branch: lp:~fgimenez/snappy/fix-failover-versions
Merge into: lp:~snappy-dev/snappy/snappy-moved-to-github
Diff against target: 258 lines (+38/-37)
4 files modified
_integration-tests/tests/failover/failover_rclocal_crash_test.go (+4/-4)
_integration-tests/tests/failover/failover_systemd_loop_test.go (+6/-6)
_integration-tests/tests/failover/failover_test.go (+12/-11)
_integration-tests/tests/failover/failover_zero_size_file_test.go (+16/-16)
To merge this branch: bzr merge lp:~fgimenez/snappy/fix-failover-versions
Reviewer Review Type Date Requested Status
Snappy Developers 2015-07-03 Pending
Review via email: mp+263765@code.launchpad.net

This proposal has been superseded by a proposal from 2015-07-06.

Commit Message

Changes in channel.ini are reverted after each test

Description of the Change

Added call to revert the changes on system-image channel.ini; added redefinition of PATH for finding the test's binaries

To post a comment you must log in.
557. By Federico Gimenez on 2015-07-03

merged trunk

558. By Federico Gimenez on 2015-07-06

merged prerequisite

559. By Federico Gimenez on 2015-07-06

merged prerequisite

560. By Federico Gimenez on 2015-07-06

merged prerequisite

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '_integration-tests/tests/failover/failover_rclocal_crash_test.go'
2--- _integration-tests/tests/failover/failover_rclocal_crash_test.go 2015-06-29 15:57:03 +0000
3+++ _integration-tests/tests/failover/failover_rclocal_crash_test.go 2015-07-03 15:39:51 +0000
4@@ -24,12 +24,12 @@
5
6 . "../common"
7
8- . "gopkg.in/check.v1"
9+ check "gopkg.in/check.v1"
10 )
11
12 type rcLocalCrash struct{}
13
14-func (rcLocalCrash) set(c *C) {
15+func (rcLocalCrash) set(c *check.C) {
16 makeWritable(c, baseOtherPath)
17 targetFile := fmt.Sprintf("%s/etc/rc.local", baseOtherPath)
18 ExecCommand(c, "sudo", "chmod", "a+xw", targetFile)
19@@ -38,12 +38,12 @@
20 makeReadonly(c, baseOtherPath)
21 }
22
23-func (rcLocalCrash) unset(c *C) {
24+func (rcLocalCrash) unset(c *check.C) {
25 makeWritable(c, baseOtherPath)
26 ExecCommand(c, "sudo", "rm", fmt.Sprintf("%s/etc/rc.local", baseOtherPath))
27 makeReadonly(c, baseOtherPath)
28 }
29
30-func (s *failoverSuite) TestRCLocalCrash(c *C) {
31+func (s *failoverSuite) TestRCLocalCrash(c *check.C) {
32 commonFailoverTest(c, rcLocalCrash{})
33 }
34
35=== modified file '_integration-tests/tests/failover/failover_systemd_loop_test.go'
36--- _integration-tests/tests/failover/failover_systemd_loop_test.go 2015-06-29 15:57:23 +0000
37+++ _integration-tests/tests/failover/failover_systemd_loop_test.go 2015-07-03 15:39:51 +0000
38@@ -24,7 +24,7 @@
39
40 . "../common"
41
42- . "gopkg.in/check.v1"
43+ check "gopkg.in/check.v1"
44 )
45
46 const (
47@@ -60,17 +60,17 @@
48
49 type systemdDependencyLoop struct{}
50
51-func (systemdDependencyLoop) set(c *C) {
52+func (systemdDependencyLoop) set(c *check.C) {
53 installService(c, "deadlock", deadlockService, baseOtherPath)
54 installService(c, "emerg-reboot", rebootService, baseOtherPath)
55 }
56
57-func (systemdDependencyLoop) unset(c *C) {
58+func (systemdDependencyLoop) unset(c *check.C) {
59 unInstallService(c, "deadlock", baseOtherPath)
60 unInstallService(c, "emerg-reboot", baseOtherPath)
61 }
62
63-func installService(c *C, serviceName, serviceCfg, basePath string) {
64+func installService(c *check.C, serviceName, serviceCfg, basePath string) {
65 makeWritable(c, basePath)
66
67 // Create service file
68@@ -93,7 +93,7 @@
69 makeReadonly(c, basePath)
70 }
71
72-func unInstallService(c *C, serviceName, basePath string) {
73+func unInstallService(c *check.C, serviceName, basePath string) {
74 makeWritable(c, basePath)
75
76 // Disable the service
77@@ -111,6 +111,6 @@
78 makeReadonly(c, basePath)
79 }
80
81-func (s *failoverSuite) TestSystemdDependencyLoop(c *C) {
82+func (s *failoverSuite) TestSystemdDependencyLoop(c *check.C) {
83 commonFailoverTest(c, systemdDependencyLoop{})
84 }
85
86=== modified file '_integration-tests/tests/failover/failover_test.go'
87--- _integration-tests/tests/failover/failover_test.go 2015-07-01 15:02:58 +0000
88+++ _integration-tests/tests/failover/failover_test.go 2015-07-03 15:39:51 +0000
89@@ -25,15 +25,15 @@
90 "path/filepath"
91 "testing"
92
93+ check "gopkg.in/check.v1"
94+
95 . "../common"
96-
97- . "gopkg.in/check.v1"
98 )
99
100 // Hook up gocheck into the "go test" runner.
101-func Test(t *testing.T) { TestingT(t) }
102+func Test(t *testing.T) { check.TestingT(t) }
103
104-var _ = Suite(&failoverSuite{})
105+var _ = check.Suite(&failoverSuite{})
106
107 type failoverSuite struct {
108 SnappySuite
109@@ -47,21 +47,22 @@
110 // The types that implement this interface can be used in the test logic
111 type failer interface {
112 // Sets the failure conditions
113- set(c *C)
114+ set(c *check.C)
115 // Unsets the failure conditions
116- unset(c *C)
117+ unset(c *check.C)
118 }
119
120 // This is the logic common to all the failover tests. Each of them has define a
121 // type implementing the failer interface and call this function with an instance
122 // of it
123-func commonFailoverTest(c *C, f failer) {
124+func commonFailoverTest(c *check.C, f failer) {
125 currentVersion := GetCurrentVersion(c)
126
127 if AfterReboot(c) {
128 RemoveRebootMark(c)
129+ defer switchChannelVersion(c, currentVersion, currentVersion+1)
130 f.unset(c)
131- c.Assert(GetSavedVersion(c), Equals, currentVersion)
132+ c.Assert(GetSavedVersion(c), check.Equals, currentVersion)
133 } else {
134 switchChannelVersion(c, currentVersion, currentVersion-1)
135 SetSavedVersion(c, currentVersion-1)
136@@ -71,7 +72,7 @@
137 }
138 }
139
140-func switchChannelVersion(c *C, oldVersion, newVersion int) {
141+func switchChannelVersion(c *check.C, oldVersion, newVersion int) {
142 targets := []string{"/", baseOtherPath}
143 for _, target := range targets {
144 file := filepath.Join(target, channelCfgFile)
145@@ -88,10 +89,10 @@
146 }
147 }
148
149-func makeWritable(c *C, path string) {
150+func makeWritable(c *check.C, path string) {
151 ExecCommand(c, "sudo", "mount", "-o", "remount,rw", path)
152 }
153
154-func makeReadonly(c *C, path string) {
155+func makeReadonly(c *check.C, path string) {
156 ExecCommand(c, "sudo", "mount", "-o", "remount,ro", path)
157 }
158
159=== modified file '_integration-tests/tests/failover/failover_zero_size_file_test.go'
160--- _integration-tests/tests/failover/failover_zero_size_file_test.go 2015-06-29 15:52:59 +0000
161+++ _integration-tests/tests/failover/failover_zero_size_file_test.go 2015-07-03 15:39:51 +0000
162@@ -26,7 +26,7 @@
163
164 . "../common"
165
166- . "gopkg.in/check.v1"
167+ check "gopkg.in/check.v1"
168 )
169
170 const (
171@@ -43,31 +43,31 @@
172 type zeroSizeInitrd struct{}
173 type zeroSizeSystemd struct{}
174
175-func (zeroSizeKernel) set(c *C) {
176+func (zeroSizeKernel) set(c *check.C) {
177 commonSet(c, origBootFilenamePattern, kernelFilename)
178 }
179
180-func (zeroSizeKernel) unset(c *C) {
181+func (zeroSizeKernel) unset(c *check.C) {
182 commonUnset(c, origBootFilenamePattern, kernelFilename)
183 }
184
185-func (zeroSizeInitrd) set(c *C) {
186+func (zeroSizeInitrd) set(c *check.C) {
187 commonSet(c, origBootFilenamePattern, initrdFilename)
188 }
189
190-func (zeroSizeInitrd) unset(c *C) {
191+func (zeroSizeInitrd) unset(c *check.C) {
192 commonUnset(c, origBootFilenamePattern, initrdFilename)
193 }
194
195-func (zeroSizeSystemd) set(c *C) {
196+func (zeroSizeSystemd) set(c *check.C) {
197 commonSet(c, origSystemdFilenamePattern, systemdFilename)
198 }
199
200-func (zeroSizeSystemd) unset(c *C) {
201+func (zeroSizeSystemd) unset(c *check.C) {
202 commonUnset(c, origSystemdFilenamePattern, systemdFilename)
203 }
204
205-func commonSet(c *C, origPattern, filename string) {
206+func commonSet(c *check.C, origPattern, filename string) {
207 filenamePattern := fmt.Sprintf(origPattern, "", filename)
208 completePattern := filepath.Join(
209 baseOtherPath,
210@@ -81,7 +81,7 @@
211 renameFile(c, baseOtherPath, oldFilename, newFilename)
212 }
213
214-func commonUnset(c *C, origPattern, filename string) {
215+func commonUnset(c *check.C, origPattern, filename string) {
216 completePattern := filepath.Join(
217 baseOtherPath,
218 fmt.Sprintf(origPattern, destFilenamePrefix, filename))
219@@ -91,32 +91,32 @@
220 renameFile(c, baseOtherPath, oldFilename, newFilename)
221 }
222
223-func renameFile(c *C, basePath, oldFilename, newFilename string) {
224+func renameFile(c *check.C, basePath, oldFilename, newFilename string) {
225 makeWritable(c, basePath)
226 ExecCommand(c, "sudo", "mv", oldFilename, newFilename)
227 ExecCommand(c, "sudo", "touch", oldFilename)
228 makeReadonly(c, basePath)
229 }
230
231-func getSingleFilename(c *C, pattern string) string {
232+func getSingleFilename(c *check.C, pattern string) string {
233 matches, err := filepath.Glob(pattern)
234
235- c.Assert(err, IsNil, Commentf("Error: %v", err))
236- c.Assert(len(matches), Equals, 1)
237+ c.Assert(err, check.IsNil, check.Commentf("Error: %v", err))
238+ c.Assert(len(matches), check.Equals, 1)
239
240 return matches[0]
241 }
242
243 /*
244-func (s *failoverSuite) TestZeroSizeKernel(c *C) {
245+func (s *failoverSuite) TestZeroSizeKernel(c *check.C) {
246 commonFailoverTest(c, zeroSizeKernel{})
247 }
248 */
249
250-func (s *failoverSuite) TestZeroSizeInitrd(c *C) {
251+func (s *failoverSuite) TestZeroSizeInitrd(c *check.C) {
252 commonFailoverTest(c, zeroSizeInitrd{})
253 }
254
255-func (s *failoverSuite) TestZeroSizeSystemd(c *C) {
256+func (s *failoverSuite) TestZeroSizeSystemd(c *check.C) {
257 commonFailoverTest(c, zeroSizeSystemd{})
258 }

Subscribers

People subscribed via source and target branches