Merge lp:~elopio/snappy/15.04_to_rolling into lp:~snappy-dev/snappy/snappy-moved-to-github
- 15.04_to_rolling
- Merge into snappy-moved-to-github
Proposed by
Leo Arias
Status: | Superseded |
---|---|
Proposed branch: | lp:~elopio/snappy/15.04_to_rolling |
Merge into: | lp:~snappy-dev/snappy/snappy-moved-to-github |
Diff against target: |
550 lines (+183/-123) 10 files modified
_integration-tests/data/tpl/control (+10/-0) _integration-tests/main.go (+95/-47) _integration-tests/tests/common/common.go (+48/-2) _integration-tests/tests/failover/failover_rclocal_crash_test.go (+6/-6) _integration-tests/tests/failover/failover_systemd_loop_test.go (+8/-10) _integration-tests/tests/failover/failover_test.go (+1/-38) _integration-tests/tests/failover/failover_zero_size_file_test.go (+7/-7) _integration-tests/tests/update/update_test.go (+4/-1) debian/integration-tests/control (+0/-11) debian/integration-tests/snappy-test (+4/-1) |
To merge this branch: | bzr merge lp:~elopio/snappy/15.04_to_rolling |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Snappy Developers | Pending | ||
Review via email:
|
This proposal has been superseded by a proposal from 2015-07-06.
Commit message
Description of the change
To post a comment you must log in.
- 548. By Leo Arias
-
Merged with trunk.
- 549. By Leo Arias
-
Merged with trunk.
- 550. By Leo Arias
-
Run only the update in the old versions, and then run the full suite.
- 551. By Leo Arias
-
Merged with trunk.
- 552. By Leo Arias
-
Merged with trunk.
- 553. By Leo Arias
-
Backup the config file.
- 554. By Leo Arias
-
Do not rollback.
- 555. By Leo Arias
-
Update the test beds and run the tests.
- 556. By Leo Arias
-
Restore the config only if the reboot has been handled.
- 557. By Leo Arias
-
Only run the update. Figure the full suite later.
- 558. By Leo Arias
-
Only run the update. Figure the full suite later.
- 559. By Leo Arias
-
No need to put the remote testbed options on the var.
- 560. By Leo Arias
-
Remove extra newline.
Unmerged revisions
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === added directory '_integration-tests/data' |
2 | === renamed directory '_integration-tests/data' => '_integration-tests/data.moved' |
3 | === added directory '_integration-tests/data/tpl' |
4 | === added file '_integration-tests/data/tpl/control' |
5 | --- _integration-tests/data/tpl/control 1970-01-01 00:00:00 +0000 |
6 | +++ _integration-tests/data/tpl/control 2015-07-06 06:57:52 +0000 |
7 | @@ -0,0 +1,10 @@ |
8 | +{{ $filter := .Filter }} |
9 | +{{ range $element := .Tests }} |
10 | +Test-Command: debian/integration-tests/snappy-test {{ $element }}.test {{ if $filter }}-gocheck.f {{ $filter }}{{ end }} |
11 | +Restrictions: allow-stderr |
12 | +{{ end }} |
13 | + |
14 | +{{ if .IncludeShell }} |
15 | +Test-Command: ./_integration-tests/snappy-selftest --yes-really |
16 | +Depends: |
17 | +{{ end }} |
18 | |
19 | === modified file '_integration-tests/main.go' |
20 | --- _integration-tests/main.go 2015-07-01 08:51:59 +0000 |
21 | +++ _integration-tests/main.go 2015-07-06 06:57:52 +0000 |
22 | @@ -28,34 +28,28 @@ |
23 | "path/filepath" |
24 | "strconv" |
25 | "strings" |
26 | + "text/template" |
27 | ) |
28 | |
29 | const ( |
30 | - baseDir = "/tmp/snappy-test" |
31 | - testsBinDir = "_integration-tests/bin/" |
32 | - defaultRelease = "rolling" |
33 | - defaultChannel = "edge" |
34 | - latestRevision = "" |
35 | - defaultSSHPort = 22 |
36 | - defaultGoArm = "7" |
37 | - latestTestName = "command1" |
38 | - failoverTestName = "command2" |
39 | - updateTestName = "command3" |
40 | - shellTestName = "command4" |
41 | + baseDir = "/tmp/snappy-test" |
42 | + testsBinDir = "_integration-tests/bin/" |
43 | + defaultRelease = "rolling" |
44 | + defaultChannel = "edge" |
45 | + defaultSSHPort = 22 |
46 | + defaultGoArm = "7" |
47 | + controlFile = "debian/integration-tests/control" |
48 | + controlTpl = "_integration-tests/data/tpl/control" |
49 | ) |
50 | |
51 | var ( |
52 | - imageDir = filepath.Join(baseDir, "image") |
53 | - imageTarget = filepath.Join(imageDir, "snappy.img") |
54 | - commonSSHOptions = []string{"---", "ssh"} |
55 | - kvmSSHOptions = append( |
56 | - commonSSHOptions, |
57 | - []string{ |
58 | - "-s", "/usr/share/autopkgtest/ssh-setup/snappy", |
59 | - "--", "-i", imageTarget}...) |
60 | + commonSSHOptions = []string{"---", "ssh"} |
61 | + testPackagesLatest = []string{"latest", "failover"} |
62 | + testPackagesPrevious = []string{"update"} |
63 | + testPackages = append(testPackagesLatest, testPackagesPrevious...) |
64 | ) |
65 | |
66 | -func setupAndRunTests(useSnappyFromBranch bool, arch, testbedIP string, testbedPort int) { |
67 | +func setupAndRunTests(useSnappyFromBranch bool, arch, testbedIP, testFilter string, testbedPort int) { |
68 | prepareTargetDir(testsBinDir) |
69 | |
70 | if useSnappyFromBranch { |
71 | @@ -66,21 +60,27 @@ |
72 | buildTests(arch) |
73 | |
74 | rootPath := getRootPath() |
75 | + |
76 | if testbedIP == "" { |
77 | - createImage(defaultRelease, defaultChannel, latestRevision) |
78 | - latestTests := []string{ |
79 | - latestTestName, failoverTestName, shellTestName} |
80 | - for i := range latestTests { |
81 | - adtRun(rootPath, kvmSSHOptions, latestTests[i]) |
82 | - } |
83 | - |
84 | - createImage(defaultRelease, defaultChannel, "-1") |
85 | - adtRun(rootPath, kvmSSHOptions, updateTestName) |
86 | + var includeShell bool |
87 | + if testFilter == "" { |
88 | + includeShell = true |
89 | + } |
90 | + image := createImage(defaultRelease, defaultChannel, "") |
91 | + adtRun(rootPath, testFilter, testPackages, kvmSSHOptions(image), includeShell) |
92 | + // It does not make sense to run tests on previous versions using the |
93 | + // snappy version from the branch. These other tests are only for nightly |
94 | + // executions. |
95 | + if !useSnappyFromBranch { |
96 | + image = createImage(defaultRelease, defaultChannel, "-1") |
97 | + adtRun(rootPath, testFilter, testPackages, kvmSSHOptions(image), includeShell) |
98 | + image = createImage("15.04", "stable", "") |
99 | + adtRun(rootPath, testFilter, testPackages, kvmSSHOptions(image), includeShell) |
100 | + } |
101 | } else { |
102 | execCommand("ssh-copy-id", "-p", strconv.Itoa(testbedPort), |
103 | "ubuntu@"+testbedIP) |
104 | - adtRun(rootPath, remoteTestbedSSHOptions(testbedIP, testbedPort), |
105 | - shellTestName) |
106 | + adtRun(rootPath, "", []string{}, remoteTestbedSSHOptions(testbedIP, testbedPort), true) |
107 | } |
108 | } |
109 | |
110 | @@ -103,9 +103,8 @@ |
111 | |
112 | func buildTests(arch string) { |
113 | fmt.Println("Building tests...") |
114 | - tests := []string{"latest", "failover", "update"} |
115 | - for i := range tests { |
116 | - testName := tests[i] |
117 | + |
118 | + for _, testName := range testPackages { |
119 | goCall(arch, "test", "-c", |
120 | "./_integration-tests/tests/"+testName) |
121 | // XXX Go test 1.3 does not have the output flag, so we move the |
122 | @@ -127,42 +126,89 @@ |
123 | execCommand(goCmd...) |
124 | } |
125 | |
126 | -func createImage(release, channel, revision string) { |
127 | +func createImage(release, channel, revision string) string { |
128 | fmt.Println("Creating image...") |
129 | + imageDir := filepath.Join(baseDir, "image") |
130 | prepareTargetDir(imageDir) |
131 | + revisionTag := revision |
132 | + if revisionTag == "" { |
133 | + revisionTag = "latest" |
134 | + } |
135 | + imageName := strings.Join( |
136 | + []string{"snappy", release, channel, revisionTag}, "-") + ".img" |
137 | + imagePath := filepath.Join(imageDir, imageName) |
138 | udfCommand := []string{"sudo", "ubuntu-device-flash", "--verbose"} |
139 | - if revision != latestRevision { |
140 | + if revision != "" { |
141 | udfCommand = append(udfCommand, "--revision", revision) |
142 | } |
143 | coreOptions := []string{ |
144 | "core", release, |
145 | - "--output", imageTarget, |
146 | + "--output", imagePath, |
147 | "--channel", channel, |
148 | "--developer-mode", |
149 | } |
150 | execCommand(append(udfCommand, coreOptions...)...) |
151 | + return imagePath |
152 | } |
153 | |
154 | -func adtRun(rootPath string, testbedOptions []string, testname string) { |
155 | +func adtRun(rootPath, testFilter string, testList, testbedOptions []string, includeShell bool) { |
156 | + createControlFile(testFilter, testList, includeShell) |
157 | + |
158 | fmt.Println("Calling adt-run...") |
159 | - outputDir := filepath.Join(baseDir, "output") |
160 | + outputSubdir := getOutputSubdir(testList, includeShell) |
161 | + outputDir := filepath.Join(baseDir, "output", outputSubdir) |
162 | prepareTargetDir(outputDir) |
163 | |
164 | cmd := []string{ |
165 | "adt-run", "-B", |
166 | - "--override-control", "debian/integration-tests/control"} |
167 | - |
168 | - cmd = append(cmd, "--testname", testname) |
169 | - |
170 | - cmd = append(cmd, []string{ |
171 | "--setup-commands", "touch /run/autopkgtest_no_reboot.stamp", |
172 | - "--override-control", "debian/integration-tests/control", |
173 | + "--override-control", controlFile, |
174 | "--built-tree", rootPath, |
175 | - "--output-dir", outputDir}...) |
176 | + "--output-dir", outputDir} |
177 | |
178 | execCommand(append(cmd, testbedOptions...)...) |
179 | } |
180 | |
181 | +func kvmSSHOptions(imagePath string) []string { |
182 | + return append( |
183 | + commonSSHOptions, |
184 | + []string{ |
185 | + "-s", "/usr/share/autopkgtest/ssh-setup/snappy", |
186 | + "--", "-i", imagePath}...) |
187 | +} |
188 | + |
189 | +func createControlFile(testFilter string, testList []string, includeShellTest bool) { |
190 | + type controlData struct { |
191 | + Filter string |
192 | + Tests []string |
193 | + IncludeShell bool |
194 | + } |
195 | + |
196 | + tpl, err := template.ParseFiles(controlTpl) |
197 | + if err != nil { |
198 | + log.Fatalf("Error reading adt-run control template %s", controlTpl) |
199 | + } |
200 | + |
201 | + outputFile, err := os.Create(controlFile) |
202 | + if err != nil { |
203 | + log.Fatalf("Error creating control file %s", controlFile) |
204 | + } |
205 | + defer outputFile.Close() |
206 | + |
207 | + err = tpl.Execute(outputFile, controlData{Filter: testFilter, Tests: testList, IncludeShell: includeShellTest}) |
208 | + if err != nil { |
209 | + log.Fatalf("execution: %s", err) |
210 | + } |
211 | +} |
212 | + |
213 | +func getOutputSubdir(testList []string, includeShell bool) string { |
214 | + output := strings.Join(testList, "-") |
215 | + if includeShell { |
216 | + output = output + "-shell" |
217 | + } |
218 | + return output |
219 | +} |
220 | + |
221 | func remoteTestbedSSHOptions(testbedIP string, testbedPort int) []string { |
222 | options := []string{ |
223 | "-H", testbedIP, |
224 | @@ -199,9 +245,11 @@ |
225 | "IP of the testbed. If no IP is passed, a virtual machine will be created for the test.") |
226 | testbedPort = flag.Int("port", defaultSSHPort, |
227 | "SSH port of the testbed. Defaults to use port "+strconv.Itoa(defaultSSHPort)) |
228 | + testFilter = flag.String("filter", "", |
229 | + "Suites or tests to run, for instance MyTestSuite, MyTestSuite.FirstCustomTest or MyTestSuite.*CustomTest") |
230 | ) |
231 | |
232 | flag.Parse() |
233 | |
234 | - setupAndRunTests(*useSnappyFromBranch, *arch, *testbedIP, *testbedPort) |
235 | + setupAndRunTests(*useSnappyFromBranch, *arch, *testbedIP, *testFilter, *testbedPort) |
236 | } |
237 | |
238 | === modified file '_integration-tests/tests/common/common.go' |
239 | --- _integration-tests/tests/common/common.go 2015-07-02 10:41:16 +0000 |
240 | +++ _integration-tests/tests/common/common.go 2015-07-06 06:57:52 +0000 |
241 | @@ -33,7 +33,11 @@ |
242 | ) |
243 | |
244 | const ( |
245 | + // BaseOtherPath FIXME needs a better name because I don't know what to |
246 | + // comment. |
247 | + BaseOtherPath = "/writable/cache/system" |
248 | needsRebootFile = "/tmp/needs-reboot" |
249 | + channelCfgFile = "/etc/system-image/channel.ini" |
250 | ) |
251 | |
252 | // SnappySuite is a structure used as a base test suite for all the snappy |
253 | @@ -117,10 +121,52 @@ |
254 | return version |
255 | } |
256 | |
257 | -// CallUpdate executes an snappy update. |
258 | +// CallUpdate executes an snappy update. If there is no update available, the |
259 | +// channel version will be modified to fake an update. |
260 | func CallUpdate(c *check.C) { |
261 | c.Log("Calling snappy update...") |
262 | - ExecCommand(c, "sudo", "snappy", "update") |
263 | + output := ExecCommand(c, "sudo", "snappy", "update") |
264 | + // XXX Instead of trying the update, we should have a command to tell us |
265 | + // if there is an available update. --elopio - 2015-07-01 |
266 | + if output == "" { |
267 | + c.Log("There is no update available.") |
268 | + fakeAvailableUpdate(c) |
269 | + ExecCommand(c, "sudo", "snappy", "update") |
270 | + } |
271 | +} |
272 | + |
273 | +func fakeAvailableUpdate(c *check.C) { |
274 | + c.Log("Faking an available update...") |
275 | + currentVersion := GetCurrentVersion(c) |
276 | + switchChannelVersion(c, currentVersion, currentVersion-1) |
277 | + SetSavedVersion(c, currentVersion-1) |
278 | +} |
279 | + |
280 | +func switchChannelVersion(c *check.C, oldVersion, newVersion int) { |
281 | + targets := []string{"/", BaseOtherPath} |
282 | + for _, target := range targets { |
283 | + file := filepath.Join(target, channelCfgFile) |
284 | + if _, err := os.Stat(file); err == nil { |
285 | + MakeWritable(c, target) |
286 | + defer MakeReadonly(c, target) |
287 | + ExecCommand(c, |
288 | + "sudo", "sed", "-i", |
289 | + fmt.Sprintf( |
290 | + "s/build_number: %d/build_number: %d/g", |
291 | + oldVersion, newVersion), |
292 | + file) |
293 | + } |
294 | + } |
295 | +} |
296 | + |
297 | +// MakeWritable remounts a path with read and write permissions. |
298 | +func MakeWritable(c *check.C, path string) { |
299 | + ExecCommand(c, "sudo", "mount", "-o", "remount,rw", path) |
300 | +} |
301 | + |
302 | +// MakeReadonly remounts a path with only read permissions. |
303 | +func MakeReadonly(c *check.C, path string) { |
304 | + ExecCommand(c, "sudo", "mount", "-o", "remount,ro", path) |
305 | } |
306 | |
307 | // Reboot requests a reboot using the test name as the mark. |
308 | |
309 | === modified file '_integration-tests/tests/failover/failover_rclocal_crash_test.go' |
310 | --- _integration-tests/tests/failover/failover_rclocal_crash_test.go 2015-06-29 15:57:03 +0000 |
311 | +++ _integration-tests/tests/failover/failover_rclocal_crash_test.go 2015-07-06 06:57:52 +0000 |
312 | @@ -30,18 +30,18 @@ |
313 | type rcLocalCrash struct{} |
314 | |
315 | func (rcLocalCrash) set(c *C) { |
316 | - makeWritable(c, baseOtherPath) |
317 | - targetFile := fmt.Sprintf("%s/etc/rc.local", baseOtherPath) |
318 | + MakeWritable(c, BaseOtherPath) |
319 | + defer MakeReadonly(c, BaseOtherPath) |
320 | + targetFile := fmt.Sprintf("%s/etc/rc.local", BaseOtherPath) |
321 | ExecCommand(c, "sudo", "chmod", "a+xw", targetFile) |
322 | ExecCommandToFile(c, targetFile, |
323 | "sudo", "echo", "#!bin/sh\nprintf c > /proc/sysrq-trigger") |
324 | - makeReadonly(c, baseOtherPath) |
325 | } |
326 | |
327 | func (rcLocalCrash) unset(c *C) { |
328 | - makeWritable(c, baseOtherPath) |
329 | - ExecCommand(c, "sudo", "rm", fmt.Sprintf("%s/etc/rc.local", baseOtherPath)) |
330 | - makeReadonly(c, baseOtherPath) |
331 | + MakeWritable(c, BaseOtherPath) |
332 | + defer MakeReadonly(c, BaseOtherPath) |
333 | + ExecCommand(c, "sudo", "rm", fmt.Sprintf("%s/etc/rc.local", BaseOtherPath)) |
334 | } |
335 | |
336 | func (s *failoverSuite) TestRCLocalCrash(c *C) { |
337 | |
338 | === modified file '_integration-tests/tests/failover/failover_systemd_loop_test.go' |
339 | --- _integration-tests/tests/failover/failover_systemd_loop_test.go 2015-06-29 15:57:23 +0000 |
340 | +++ _integration-tests/tests/failover/failover_systemd_loop_test.go 2015-07-06 06:57:52 +0000 |
341 | @@ -61,17 +61,18 @@ |
342 | type systemdDependencyLoop struct{} |
343 | |
344 | func (systemdDependencyLoop) set(c *C) { |
345 | - installService(c, "deadlock", deadlockService, baseOtherPath) |
346 | - installService(c, "emerg-reboot", rebootService, baseOtherPath) |
347 | + installService(c, "deadlock", deadlockService, BaseOtherPath) |
348 | + installService(c, "emerg-reboot", rebootService, BaseOtherPath) |
349 | } |
350 | |
351 | func (systemdDependencyLoop) unset(c *C) { |
352 | - unInstallService(c, "deadlock", baseOtherPath) |
353 | - unInstallService(c, "emerg-reboot", baseOtherPath) |
354 | + unInstallService(c, "deadlock", BaseOtherPath) |
355 | + unInstallService(c, "emerg-reboot", BaseOtherPath) |
356 | } |
357 | |
358 | func installService(c *C, serviceName, serviceCfg, basePath string) { |
359 | - makeWritable(c, basePath) |
360 | + MakeWritable(c, basePath) |
361 | + defer MakeReadonly(c, basePath) |
362 | |
363 | // Create service file |
364 | serviceFile := fmt.Sprintf("%s%s/%s.service", basePath, baseSystemdPath, serviceName) |
365 | @@ -89,12 +90,11 @@ |
366 | fmt.Sprintf("%s/%s.service", baseSystemdPath, serviceName), |
367 | fmt.Sprintf("%s/%s.service", requiresDirPart, serviceName), |
368 | ) |
369 | - |
370 | - makeReadonly(c, basePath) |
371 | } |
372 | |
373 | func unInstallService(c *C, serviceName, basePath string) { |
374 | - makeWritable(c, basePath) |
375 | + MakeWritable(c, basePath) |
376 | + defer MakeReadonly(c, basePath) |
377 | |
378 | // Disable the service |
379 | ExecCommand(c, "sudo", "chroot", basePath, |
380 | @@ -107,8 +107,6 @@ |
381 | // Remove the requires symlink |
382 | ExecCommand(c, "sudo", "rm", |
383 | fmt.Sprintf("%s%s/%s/%s.service", basePath, baseSystemdPath, systemdTargetRequiresDir, serviceName)) |
384 | - |
385 | - makeReadonly(c, basePath) |
386 | } |
387 | |
388 | func (s *failoverSuite) TestSystemdDependencyLoop(c *C) { |
389 | |
390 | === modified file '_integration-tests/tests/failover/failover_test.go' |
391 | --- _integration-tests/tests/failover/failover_test.go 2015-07-01 15:02:58 +0000 |
392 | +++ _integration-tests/tests/failover/failover_test.go 2015-07-06 06:57:52 +0000 |
393 | @@ -20,9 +20,6 @@ |
394 | package failover |
395 | |
396 | import ( |
397 | - "fmt" |
398 | - "os" |
399 | - "path/filepath" |
400 | "testing" |
401 | |
402 | . "../common" |
403 | @@ -39,11 +36,6 @@ |
404 | SnappySuite |
405 | } |
406 | |
407 | -const ( |
408 | - baseOtherPath = "/writable/cache/system" |
409 | - channelCfgFile = "/etc/system-image/channel.ini" |
410 | -) |
411 | - |
412 | // The types that implement this interface can be used in the test logic |
413 | type failer interface { |
414 | // Sets the failure conditions |
415 | @@ -56,42 +48,13 @@ |
416 | // type implementing the failer interface and call this function with an instance |
417 | // of it |
418 | func commonFailoverTest(c *C, f failer) { |
419 | - currentVersion := GetCurrentVersion(c) |
420 | - |
421 | if AfterReboot(c) { |
422 | RemoveRebootMark(c) |
423 | f.unset(c) |
424 | - c.Assert(GetSavedVersion(c), Equals, currentVersion) |
425 | + c.Assert(GetSavedVersion(c), Equals, GetCurrentVersion(c)) |
426 | } else { |
427 | - switchChannelVersion(c, currentVersion, currentVersion-1) |
428 | - SetSavedVersion(c, currentVersion-1) |
429 | CallUpdate(c) |
430 | f.set(c) |
431 | Reboot(c) |
432 | } |
433 | } |
434 | - |
435 | -func switchChannelVersion(c *C, oldVersion, newVersion int) { |
436 | - targets := []string{"/", baseOtherPath} |
437 | - for _, target := range targets { |
438 | - file := filepath.Join(target, channelCfgFile) |
439 | - if _, err := os.Stat(file); err == nil { |
440 | - makeWritable(c, target) |
441 | - ExecCommand(c, |
442 | - "sudo", "sed", "-i", |
443 | - fmt.Sprintf( |
444 | - "s/build_number: %d/build_number: %d/g", |
445 | - oldVersion, newVersion), |
446 | - file) |
447 | - makeReadonly(c, target) |
448 | - } |
449 | - } |
450 | -} |
451 | - |
452 | -func makeWritable(c *C, path string) { |
453 | - ExecCommand(c, "sudo", "mount", "-o", "remount,rw", path) |
454 | -} |
455 | - |
456 | -func makeReadonly(c *C, path string) { |
457 | - ExecCommand(c, "sudo", "mount", "-o", "remount,ro", path) |
458 | -} |
459 | |
460 | === modified file '_integration-tests/tests/failover/failover_zero_size_file_test.go' |
461 | --- _integration-tests/tests/failover/failover_zero_size_file_test.go 2015-06-29 15:52:59 +0000 |
462 | +++ _integration-tests/tests/failover/failover_zero_size_file_test.go 2015-07-06 06:57:52 +0000 |
463 | @@ -70,32 +70,32 @@ |
464 | func commonSet(c *C, origPattern, filename string) { |
465 | filenamePattern := fmt.Sprintf(origPattern, "", filename) |
466 | completePattern := filepath.Join( |
467 | - baseOtherPath, |
468 | + BaseOtherPath, |
469 | filenamePattern) |
470 | oldFilename := getSingleFilename(c, completePattern) |
471 | filenameSuffix := fmt.Sprintf( |
472 | strings.Replace(origPattern, "*", "", 1), destFilenamePrefix, filepath.Base(oldFilename)) |
473 | newFilename := fmt.Sprintf( |
474 | - "%s/%s", baseOtherPath, filenameSuffix) |
475 | + "%s/%s", BaseOtherPath, filenameSuffix) |
476 | |
477 | - renameFile(c, baseOtherPath, oldFilename, newFilename) |
478 | + renameFile(c, BaseOtherPath, oldFilename, newFilename) |
479 | } |
480 | |
481 | func commonUnset(c *C, origPattern, filename string) { |
482 | completePattern := filepath.Join( |
483 | - baseOtherPath, |
484 | + BaseOtherPath, |
485 | fmt.Sprintf(origPattern, destFilenamePrefix, filename)) |
486 | oldFilename := getSingleFilename(c, completePattern) |
487 | newFilename := strings.Replace(oldFilename, destFilenamePrefix, "", 1) |
488 | |
489 | - renameFile(c, baseOtherPath, oldFilename, newFilename) |
490 | + renameFile(c, BaseOtherPath, oldFilename, newFilename) |
491 | } |
492 | |
493 | func renameFile(c *C, basePath, oldFilename, newFilename string) { |
494 | - makeWritable(c, basePath) |
495 | + MakeWritable(c, basePath) |
496 | + defer MakeReadonly(c, basePath) |
497 | ExecCommand(c, "sudo", "mv", oldFilename, newFilename) |
498 | ExecCommand(c, "sudo", "touch", oldFilename) |
499 | - makeReadonly(c, basePath) |
500 | } |
501 | |
502 | func getSingleFilename(c *C, pattern string) string { |
503 | |
504 | === modified file '_integration-tests/tests/update/update_test.go' |
505 | --- _integration-tests/tests/update/update_test.go 2015-06-30 16:51:24 +0000 |
506 | +++ _integration-tests/tests/update/update_test.go 2015-07-06 06:57:52 +0000 |
507 | @@ -45,7 +45,10 @@ |
508 | } |
509 | } |
510 | |
511 | -func (s *updateSuite) TestUpdateMustInstallNewerVersion(c *C) { |
512 | +// Test that the update to the same release and channel must install a newer |
513 | +// version. If there is no update available, the channel version will be |
514 | +// modified to fake an update. |
515 | +func (s *updateSuite) TestUpdateToSameReleaseAndChannel(c *C) { |
516 | if BeforeReboot() { |
517 | CallUpdate(c) |
518 | Reboot(c) |
519 | |
520 | === removed file 'debian/integration-tests/control' |
521 | --- debian/integration-tests/control 2015-06-30 15:29:28 +0000 |
522 | +++ debian/integration-tests/control 1970-01-01 00:00:00 +0000 |
523 | @@ -1,11 +0,0 @@ |
524 | -Test-Command: debian/integration-tests/snappy-test latest.test |
525 | -Restrictions: allow-stderr |
526 | - |
527 | -Test-Command: debian/integration-tests/snappy-test failover.test |
528 | -Restrictions: allow-stderr |
529 | - |
530 | -Test-Command: debian/integration-tests/snappy-test update.test |
531 | -Restrictions: allow-stderr |
532 | - |
533 | -Test-Command: ./_integration-tests/snappy-selftest --yes-really |
534 | -Depends: |
535 | |
536 | === modified file 'debian/integration-tests/snappy-test' |
537 | --- debian/integration-tests/snappy-test 2015-07-03 11:04:00 +0000 |
538 | +++ debian/integration-tests/snappy-test 2015-07-06 06:57:52 +0000 |
539 | @@ -23,7 +23,10 @@ |
540 | |
541 | export PATH=$(pwd)/_integration-tests/bin:$PATH |
542 | |
543 | -${TEST} -check.vv -test.outputdir=$ADT_ARTIFACTS-$ADT_REBOOT_MARK |
544 | +# shift to remove the test binary name (first argument) and be able to pass the rest |
545 | +# of them to it |
546 | +shift |
547 | +${TEST} -check.vv -test.outputdir=$ADT_ARTIFACTS-$ADT_REBOOT_MARK "$@" |
548 | |
549 | if [ -e ${NEEDS_REBOOT} ]; then |
550 | mark=`cat ${NEEDS_REBOOT}` |