Merge lp:~fgimenez/snappy/failover-with-fake-update into lp:~snappy-dev/snappy/snappy-moved-to-github

Proposed by Federico Gimenez on 2015-07-09
Status: Merged
Approved by: Leo Arias on 2015-07-14
Approved revision: 573
Merged at revision: 578
Proposed branch: lp:~fgimenez/snappy/failover-with-fake-update
Merge into: lp:~snappy-dev/snappy/snappy-moved-to-github
Diff against target: 36 lines (+9/-3)
2 files modified
_integration-tests/tests/common/common.go (+8/-2)
_integration-tests/tests/failover/failover_test.go (+1/-1)
To merge this branch: bzr merge lp:~fgimenez/snappy/failover-with-fake-update
Reviewer Review Type Date Requested Status
Leo Arias 2015-07-09 Approve on 2015-07-14
Review via email: mp+264251@code.launchpad.net

Commit Message

Always use fake update for failover.

Description of the Change

Always use fake update for failover.

If we are using one image with an already available update (for instance, when validating the RC), the current CallUpdate method first does the update and, if didn't returned anything, the fake update.

Then, depending on the availability of an actual update the failover tests after the successful reboot can end on the current version (there was an update available and we didn't the fake) or the current version minus one (there wasn't an available update and we did the fake).

Because we cannot control the availability of an update to have a controlled state we should do always a fake update, moreover we are not testing here the update itself, but the failover capabilities.

To post a comment you must log in.
Leo Arias (elopio) wrote :

I don't want to delay this anymore. Looks good, and having more control over the tests makes a lot of sense.

review: Approve
Leo Arias (elopio) wrote :

ok, I finally got to see this running after enabling the whole suite in the other branch. Land land land!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '_integration-tests/tests/common/common.go'
2--- _integration-tests/tests/common/common.go 2015-07-08 09:10:26 +0000
3+++ _integration-tests/tests/common/common.go 2015-07-09 10:11:40 +0000
4@@ -171,11 +171,17 @@
5 // if there is an available update. --elopio - 2015-07-01
6 if output == "" {
7 c.Log("There is no update available.")
8- fakeAvailableUpdate(c)
9- ExecCommand(c, "sudo", "snappy", "update")
10+ CallFakeUpdate(c)
11 }
12 }
13
14+// CallFakeUpdate calls snappy update after faking the current version
15+func CallFakeUpdate(c *check.C) {
16+ c.Log("Preparing fake and calling update.")
17+ fakeAvailableUpdate(c)
18+ ExecCommand(c, "sudo", "snappy", "update")
19+}
20+
21 func fakeAvailableUpdate(c *check.C) {
22 c.Log("Faking an available update...")
23 currentVersion := GetCurrentVersion(c)
24
25=== modified file '_integration-tests/tests/failover/failover_test.go'
26--- _integration-tests/tests/failover/failover_test.go 2015-07-07 04:22:56 +0000
27+++ _integration-tests/tests/failover/failover_test.go 2015-07-09 10:11:40 +0000
28@@ -56,7 +56,7 @@
29 c.Assert(GetSavedVersion(c), check.Equals, currentVersion)
30 } else {
31 SetSavedVersion(c, currentVersion-1)
32- CallUpdate(c)
33+ CallFakeUpdate(c)
34 f.set(c)
35 Reboot(c)
36 }

Subscribers

People subscribed via source and target branches