Merge lp:~elopio/snappy/integration-fix-rollback into lp:~snappy-dev/snappy/snappy-moved-to-github

Proposed by Leo Arias
Status: Needs review
Proposed branch: lp:~elopio/snappy/integration-fix-rollback
Merge into: lp:~snappy-dev/snappy/snappy-moved-to-github
Prerequisite: lp:~elopio/snappy/assertion_messages
Diff against target: 515 lines (+160/-122) (has conflicts)
4 files modified
_integration-tests/tests/rollback_test.go (+2/-1)
_integration-tests/testutils/partition/bootloader.go (+26/-4)
_integration-tests/testutils/partition/bootloader_test.go (+121/-106)
_integration-tests/testutils/partition/partition_test.go (+11/-11)
Text conflict in _integration-tests/tests/examples_test.go
Text conflict in _integration-tests/testutils/wait/wait_test.go
To merge this branch: bzr merge lp:~elopio/snappy/integration-fix-rollback
Reviewer Review Type Date Requested Status
Snappy Developers Pending
Review via email: mp+274651@code.launchpad.net

Commit message

Fixed the integration fake rollback test. It was using the deprecated uboot config file.

To post a comment you must log in.
Revision history for this message
Leo Arias (elopio) wrote :

This fixes the queries to the uboot, but doens't yet make the test pass in bbb.
I'm proposing this now as a clear bug fix, and I'll start to think what to do for the bbb. The problem is that it's being extra slow, so we have to increase the timeout. It would be nice to have a solution so the timeout is not hardcoded. And it would be even nicer if the bug that causes this to happen is fixed. Bug #1498293

Unmerged revisions

779. By Leo Arias

Merged with parent.

778. By Leo Arias

Check for the wait error.

777. By Leo Arias

Use the binary uboot configuration file.

776. By Leo Arias

Added a test for the grub confValue.

775. By Leo Arias

Replaced the confValue in the tests for a fake.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file '_integration-tests/tests/rollback_test.go'
--- _integration-tests/tests/rollback_test.go 2015-10-16 00:47:50 +0000
+++ _integration-tests/tests/rollback_test.go 2015-10-16 00:47:50 +0000
@@ -44,7 +44,8 @@
44 common.RemoveRebootMark(c)44 common.RemoveRebootMark(c)
45 // Workaround for bug https://bugs.launchpad.net/snappy/+bug/149829345 // Workaround for bug https://bugs.launchpad.net/snappy/+bug/1498293
46 // TODO remove once the bug is fixed. --elopio - 2015-09-3046 // TODO remove once the bug is fixed. --elopio - 2015-09-30
47 wait.ForFunction(c, "regular", partition.Mode)47 err := wait.ForFunction(c, "regular", partition.Mode)
48 c.Assert(err, check.IsNil, check.Commentf("Failed to switch to regular mode: %s", err))
48 currentVersion := common.GetCurrentUbuntuCoreVersion(c)49 currentVersion := common.GetCurrentUbuntuCoreVersion(c)
49 c.Assert(currentVersion > common.GetSavedVersion(c), check.Equals, true,50 c.Assert(currentVersion > common.GetSavedVersion(c), check.Equals, true,
50 check.Commentf("Rebooted to the wrong version: %d", currentVersion))51 check.Commentf("Rebooted to the wrong version: %d", currentVersion))
5152
=== modified file '_integration-tests/testutils/partition/bootloader.go'
--- _integration-tests/testutils/partition/bootloader.go 2015-10-02 10:29:29 +0000
+++ _integration-tests/testutils/partition/bootloader.go 2015-10-16 00:47:50 +0000
@@ -25,13 +25,15 @@
25 "os"25 "os"
26 "path/filepath"26 "path/filepath"
27 "strings"27 "strings"
28
29 "github.com/mvo5/uboot-go/uenv"
28)30)
2931
30const (32const (
31 bootBase = "/boot"33 bootBase = "/boot"
32 ubootDir = bootBase + "/uboot"34 ubootDir = bootBase + "/uboot"
33 grubDir = bootBase + "/grub"35 grubDir = bootBase + "/grub"
34 ubootConfigFile = ubootDir + "/snappy-system.txt"36 ubootConfigFile = ubootDir + "/uboot.env"
35 grubConfigFile = grubDir + "/grubenv"37 grubConfigFile = grubDir + "/grubenv"
36)38)
3739
@@ -41,6 +43,8 @@
41 // BootSystem proxies bootSystem43 // BootSystem proxies bootSystem
42 BootSystem = bootSystem44 BootSystem = bootSystem
4345
46 confValue = getConfValue
47
44 configFiles = map[string]string{"uboot": ubootConfigFile, "grub": grubConfigFile}48 configFiles = map[string]string{"uboot": ubootConfigFile, "grub": grubConfigFile}
45)49)
4650
@@ -101,14 +105,22 @@
101 return confValue("snappy_mode")105 return confValue("snappy_mode")
102}106}
103107
104func confValue(key string) (partition string, err error) {108func getConfValue(key string) (value string, err error) {
105 system, err := BootSystem()109 system, err := BootSystem()
106 if err != nil {110 if err != nil {
107 return111 return
108 }112 }
109113
110 bootConfigFile := configFiles[system]114 if system == "grub" {
115 value, err = getGrubConfValue(key)
116 } else if system == "uboot" {
117 value, err = getUbootConfValue(key)
118 }
119 return
120}
111121
122func getGrubConfValue(key string) (value string, err error) {
123 bootConfigFile := configFiles["grub"]
112 file, err := os.Open(bootConfigFile)124 file, err := os.Open(bootConfigFile)
113 if err != nil {125 if err != nil {
114 return126 return
@@ -123,7 +135,7 @@
123 if strings.HasPrefix(scanner.Text(), key) {135 if strings.HasPrefix(scanner.Text(), key) {
124 fields := strings.Split(scanner.Text(), "=")136 fields := strings.Split(scanner.Text(), "=")
125 if len(fields) > 1 {137 if len(fields) > 1 {
126 partition = fields[1]138 value = fields[1]
127 }139 }
128 return140 return
129 }141 }
@@ -131,6 +143,16 @@
131 return143 return
132}144}
133145
146func getUbootConfValue(key string) (value string, err error) {
147 bootConfigFile := configFiles["uboot"]
148 env, err := uenv.Open(bootConfigFile)
149 if err != nil {
150 return "", err
151 }
152
153 return env.Get(key), nil
154}
155
134// OtherPartition returns the backup partition, a or b.156// OtherPartition returns the backup partition, a or b.
135func OtherPartition(current string) string {157func OtherPartition(current string) string {
136 if current == "a" {158 if current == "a" {
137159
=== modified file '_integration-tests/testutils/partition/bootloader_test.go'
--- _integration-tests/testutils/partition/bootloader_test.go 2015-10-01 15:12:30 +0000
+++ _integration-tests/testutils/partition/bootloader_test.go 2015-10-16 00:47:50 +0000
@@ -23,8 +23,10 @@
23 "fmt"23 "fmt"
24 "io/ioutil"24 "io/ioutil"
25 "os"25 "os"
26 "path"
26 "testing"27 "testing"
2728
29 "github.com/mvo5/uboot-go/uenv"
28 "gopkg.in/check.v1"30 "gopkg.in/check.v1"
29)31)
3032
@@ -36,25 +38,23 @@
36 backFilepathGlob func(string) ([]string, error)38 backFilepathGlob func(string) ([]string, error)
37 filepathGlobFail bool39 filepathGlobFail bool
38 filepathGlobReturnValues []string40 filepathGlobReturnValues []string
41 backConfValue func(string) (string, error)
42 fakeConf map[string]string
39}43}
4044
41var _ = check.Suite(&bootloaderTestSuite{})45var _ = check.Suite(&bootloaderTestSuite{})
4246
43func createConfigFile(c *check.C, contents string) (name string) {
44 file, _ := ioutil.TempFile("", "snappy-bootloader-test")
45 err := ioutil.WriteFile(file.Name(), []byte(contents), 0644)
46 c.Assert(err, check.IsNil, check.Commentf("Error writing test bootloader file"))
47
48 return file.Name()
49}
50
51func (s *bootloaderTestSuite) SetUpSuite(c *check.C) {47func (s *bootloaderTestSuite) SetUpSuite(c *check.C) {
52 s.backFilepathGlob = filepathGlob48 s.backFilepathGlob = filepathGlob
53 filepathGlob = s.fakeFilepathGlob49 filepathGlob = s.fakeFilepathGlob
50 s.backConfValue = confValue
51 confValue = s.fakeConfValue
52 s.fakeConf = map[string]string{}
54}53}
5554
56func (s *bootloaderTestSuite) TearDownSuite(c *check.C) {55func (s *bootloaderTestSuite) TearDownSuite(c *check.C) {
57 filepathGlob = s.backFilepathGlob56 filepathGlob = s.backFilepathGlob
57 confValue = s.backConfValue
58}58}
5959
60func (s *bootloaderTestSuite) SetUpTest(c *check.C) {60func (s *bootloaderTestSuite) SetUpTest(c *check.C) {
@@ -73,6 +73,10 @@
73 return s.filepathGlobReturnValues, nil73 return s.filepathGlobReturnValues, nil
74}74}
7575
76func (s *bootloaderTestSuite) fakeConfValue(key string) (value string, err error) {
77 return s.fakeConf[key], nil
78}
79
76func (s *bootloaderTestSuite) TestOtherPartition(c *check.C) {80func (s *bootloaderTestSuite) TestOtherPartition(c *check.C) {
77 c.Assert(OtherPartition("a"), check.Equals, "b",81 c.Assert(OtherPartition("a"), check.Equals, "b",
78 check.Commentf("Expected OtherPartition of 'a' to be 'b'"))82 check.Commentf("Expected OtherPartition of 'a' to be 'b'"))
@@ -98,11 +102,11 @@
98func (s *bootloaderTestSuite) TestBootSystemCallsFilepathGlob(c *check.C) {102func (s *bootloaderTestSuite) TestBootSystemCallsFilepathGlob(c *check.C) {
99 BootSystem()103 BootSystem()
100104
101 path := bootBase + "/grub"105 p := bootBase + "/grub"
102 calls := s.filepathGlobCalls[path]106 calls := s.filepathGlobCalls[p]
103107
104 c.Assert(calls, check.Equals, 1,108 c.Assert(calls, check.Equals, 1,
105 check.Commentf("Expected calls to filepath.Glob with path %s to be 1, %d found", path, calls))109 check.Commentf("Expected calls to filepath.Glob with path %s to be 1, %d found", p, calls))
106}110}
107111
108func (s *bootloaderTestSuite) TestBootSystemForGrub(c *check.C) {112func (s *bootloaderTestSuite) TestBootSystemForGrub(c *check.C) {
@@ -126,6 +130,11 @@
126}130}
127131
128func (s *bootloaderTestSuite) TestNextBootPartitionReturnsBootSystemError(c *check.C) {132func (s *bootloaderTestSuite) TestNextBootPartitionReturnsBootSystemError(c *check.C) {
133 s.fakeConf = map[string]string{
134 "snappy_mode": "try",
135 "snappy_ab": "dummy",
136 }
137
129 backBootSystem := BootSystem138 backBootSystem := BootSystem
130 defer func() { BootSystem = backBootSystem }()139 defer func() { BootSystem = backBootSystem }()
131 expectedErr := fmt.Errorf("Error from BootSystem!")140 expectedErr := fmt.Errorf("Error from BootSystem!")
@@ -139,30 +148,8 @@
139 check.Commentf("Expected error %v not found, %v", expectedErr, err))148 check.Commentf("Expected error %v not found, %v", expectedErr, err))
140}149}
141150
142func (s *bootloaderTestSuite) TestNextBootPartitionReturnsOsOpenError(c *check.C) {
143 backBootSystem := BootSystem
144 defer func() { BootSystem = backBootSystem }()
145 BootSystem = func() (system string, err error) {
146 return "not-expected-system", nil
147 }
148
149 backConfigFiles := configFiles
150 defer func() { configFiles = backConfigFiles }()
151 configFiles = map[string]string{"not-expected-system": "not-a-file"}
152
153 _, err := NextBootPartition()
154
155 c.Assert(err, check.FitsTypeOf, &os.PathError{},
156 check.Commentf("Expected error type *os.PathError not found, %T", err))
157}
158
159func (s *bootloaderTestSuite) TestNextBootPartitionReturnsEmptyIfPatternsNotFound(c *check.C) {151func (s *bootloaderTestSuite) TestNextBootPartitionReturnsEmptyIfPatternsNotFound(c *check.C) {
160 cfgFile := createConfigFile(c, "snappy_mode=try")152 s.fakeConf = map[string]string{"snappy_mode": "try"}
161 defer os.Remove(cfgFile)
162
163 backConfigFiles := configFiles
164 defer func() { configFiles = backConfigFiles }()
165 configFiles = map[string]string{"test-system": cfgFile}
166153
167 backBootSystem := BootSystem154 backBootSystem := BootSystem
168 defer func() { BootSystem = backBootSystem }()155 defer func() { BootSystem = backBootSystem }()
@@ -178,16 +165,10 @@
178}165}
179166
180func (s *bootloaderTestSuite) TestNextBootPartitionReturnsSamePartitionForGrub(c *check.C) {167func (s *bootloaderTestSuite) TestNextBootPartitionReturnsSamePartitionForGrub(c *check.C) {
181 cfgFileContents := `blabla168 s.fakeConf = map[string]string{
182snappy_mode=try169 "snappy_mode": "try",
183snappy_ab=a170 "snappy_ab": "a",
184blabla`171 }
185 cfgFile := createConfigFile(c, cfgFileContents)
186 defer os.Remove(cfgFile)
187
188 backConfigFiles := configFiles
189 defer func() { configFiles = backConfigFiles }()
190 configFiles = map[string]string{"grub": cfgFile}
191172
192 backBootSystem := BootSystem173 backBootSystem := BootSystem
193 defer func() { BootSystem = backBootSystem }()174 defer func() { BootSystem = backBootSystem }()
@@ -203,16 +184,10 @@
203}184}
204185
205func (s *bootloaderTestSuite) TestNextBootPartitionReturnsOtherPartitionForUBoot(c *check.C) {186func (s *bootloaderTestSuite) TestNextBootPartitionReturnsOtherPartitionForUBoot(c *check.C) {
206 cfgFileContents := `blabla187 s.fakeConf = map[string]string{
207snappy_mode=try188 "snappy_mode": "try",
208snappy_ab=a189 "snappy_ab": "a",
209blabla`190 }
210 cfgFile := createConfigFile(c, cfgFileContents)
211 defer os.Remove(cfgFile)
212
213 backConfigFiles := configFiles
214 defer func() { configFiles = backConfigFiles }()
215 configFiles = map[string]string{"uboot": cfgFile}
216191
217 backBootSystem := BootSystem192 backBootSystem := BootSystem
218 defer func() { BootSystem = backBootSystem }()193 defer func() { BootSystem = backBootSystem }()
@@ -228,20 +203,8 @@
228}203}
229204
230func (s *bootloaderTestSuite) TestModeReturnsSnappyModeFromConf(c *check.C) {205func (s *bootloaderTestSuite) TestModeReturnsSnappyModeFromConf(c *check.C) {
231 cfgFileContents := `blabla206 s.fakeConf = map[string]string{
232snappy_mode=test_mode207 "snappy_mode": "test_mode",
233blabla`
234 cfgFile := createConfigFile(c, cfgFileContents)
235 defer os.Remove(cfgFile)
236
237 backConfigFiles := configFiles
238 defer func() { configFiles = backConfigFiles }()
239 configFiles = map[string]string{"test-system": cfgFile}
240
241 backBootSystem := BootSystem
242 defer func() { BootSystem = backBootSystem }()
243 BootSystem = func() (system string, err error) {
244 return "test-system", nil
245 }208 }
246209
247 mode, err := Mode()210 mode, err := Mode()
@@ -251,40 +214,22 @@
251}214}
252215
253func (s *bootloaderTestSuite) TestCurrentPartitionNotOnTryMode(c *check.C) {216func (s *bootloaderTestSuite) TestCurrentPartitionNotOnTryMode(c *check.C) {
254 cfgFileContents := `blabla217 s.fakeConf = map[string]string{
255snappy_mode=nottry218 "snappy_mode": "nottry",
256snappy_ab=test_partition219 "snappy_ab": "test_partition",
257blabla`
258 cfgFile := createConfigFile(c, cfgFileContents)
259 defer os.Remove(cfgFile)
260
261 backConfigFiles := configFiles
262 defer func() { configFiles = backConfigFiles }()
263 configFiles = map[string]string{"test-system": cfgFile}
264
265 backBootSystem := BootSystem
266 defer func() { BootSystem = backBootSystem }()
267 BootSystem = func() (system string, err error) {
268 return "test-system", nil
269 }220 }
270221
271 mode, err := CurrentPartition()222 part, err := CurrentPartition()
272223
273 c.Assert(err, check.IsNil, check.Commentf("Unexpected error %v", err))224 c.Assert(err, check.IsNil, check.Commentf("Unexpected error %v", err))
274 c.Assert(mode, check.Equals, "test_partition", check.Commentf("Wrong partition"))225 c.Assert(part, check.Equals, "test_partition", check.Commentf("Wrong partition"))
275}226}
276227
277func (s *bootloaderTestSuite) TestCurrentPartitionOnTryModeReturnsSamePartitionForUboot(c *check.C) {228func (s *bootloaderTestSuite) TestCurrentPartitionOnTryModeReturnsSamePartitionForUboot(c *check.C) {
278 cfgFileContents := `blabla229 s.fakeConf = map[string]string{
279snappy_mode=try230 "snappy_mode": "try",
280snappy_ab=a231 "snappy_ab": "a",
281blabla`232 }
282 cfgFile := createConfigFile(c, cfgFileContents)
283 defer os.Remove(cfgFile)
284
285 backConfigFiles := configFiles
286 defer func() { configFiles = backConfigFiles }()
287 configFiles = map[string]string{"uboot": cfgFile}
288233
289 backBootSystem := BootSystem234 backBootSystem := BootSystem
290 defer func() { BootSystem = backBootSystem }()235 defer func() { BootSystem = backBootSystem }()
@@ -298,17 +243,11 @@
298 c.Assert(mode, check.Equals, "a", check.Commentf("Wrong partition"))243 c.Assert(mode, check.Equals, "a", check.Commentf("Wrong partition"))
299}244}
300245
301func (s *bootloaderTestSuite) TestCurrentPartitionOnTryModeReturnsOtherPartitionForUboot(c *check.C) {246func (s *bootloaderTestSuite) TestCurrentPartitionOnTryModeReturnsOtherPartitionForGrub(c *check.C) {
302 cfgFileContents := `blabla247 s.fakeConf = map[string]string{
303snappy_mode=try248 "snappy_mode": "try",
304snappy_ab=a249 "snappy_ab": "a",
305blabla`250 }
306 cfgFile := createConfigFile(c, cfgFileContents)
307 defer os.Remove(cfgFile)
308
309 backConfigFiles := configFiles
310 defer func() { configFiles = backConfigFiles }()
311 configFiles = map[string]string{"grub": cfgFile}
312251
313 backBootSystem := BootSystem252 backBootSystem := BootSystem
314 defer func() { BootSystem = backBootSystem }()253 defer func() { BootSystem = backBootSystem }()
@@ -321,3 +260,79 @@
321 c.Assert(err, check.IsNil, check.Commentf("Unexpected error %v", err))260 c.Assert(err, check.IsNil, check.Commentf("Unexpected error %v", err))
322 c.Assert(mode, check.Equals, "b", check.Commentf("Wrong partition"))261 c.Assert(mode, check.Equals, "b", check.Commentf("Wrong partition"))
323}262}
263
264type confTestSuite struct {
265 backBootSystem func() (string, error)
266 system string
267 backConfigFiles map[string]string
268}
269
270var _ = check.Suite(&confTestSuite{})
271
272func (s *confTestSuite) SetUpSuite(c *check.C) {
273 s.backBootSystem = BootSystem
274 BootSystem = s.fakeBootSystem
275 s.backConfigFiles = configFiles
276}
277
278func (s *confTestSuite) fakeBootSystem() (system string, err error) {
279 return s.system, nil
280}
281
282func (s *confTestSuite) TearDownSuite(c *check.C) {
283 BootSystem = s.backBootSystem
284 configFiles = s.backConfigFiles
285}
286
287func createConfigFile(c *check.C, system string, contents map[string]string) (name string) {
288 if system == "grub" {
289 name = createGrubConfigFile(c, contents)
290 } else if system == "uboot" {
291 name = createUbootConfigFile(c, contents)
292 }
293 return
294}
295
296func createGrubConfigFile(c *check.C, contents map[string]string) (name string) {
297 var contentsStr string
298 for key, value := range contents {
299 contentsStr += fmt.Sprintf("%s=%s\n", key, value)
300 }
301 file, err := ioutil.TempFile("", "snappy-grub-test")
302 c.Assert(err, check.IsNil, check.Commentf("Error creating temp file: %s", err))
303 err = ioutil.WriteFile(file.Name(), []byte(contentsStr), 0644)
304 c.Assert(err, check.IsNil, check.Commentf("Error writing test bootloader file: %s", err))
305
306 return file.Name()
307}
308
309func createUbootConfigFile(c *check.C, contents map[string]string) (name string) {
310 tmpDir, err := ioutil.TempDir("", "snappy-uboot-test")
311 c.Assert(err, check.IsNil, check.Commentf("Error creating temp dir: %s", err))
312 fileName := path.Join(tmpDir, "uboot.env")
313 env, err := uenv.Create(fileName, 4096)
314 c.Assert(err, check.IsNil, check.Commentf("Error creating the uboot env file: %s", err))
315 for key, value := range contents {
316 env.Set(key, value)
317 }
318 err = env.Save()
319 c.Assert(err, check.IsNil, check.Commentf("Error saving the uboot env file: %s", err))
320 return fileName
321}
322
323func (s *confTestSuite) TestGetConfValue(c *check.C) {
324 for _, s.system = range []string{"grub", "uboot"} {
325 cfgFileContents := map[string]string{
326 "blabla1": "bla",
327 "testkey": "testvalue",
328 "blabla2": "bla",
329 }
330 cfgFile := createConfigFile(c, s.system, cfgFileContents)
331 defer os.Remove(cfgFile)
332 configFiles = map[string]string{s.system: cfgFile}
333
334 value, err := confValue("testkey")
335 c.Check(err, check.IsNil, check.Commentf("Error getting configuration value: %s", err))
336 c.Check(value, check.Equals, "testvalue", check.Commentf("Wrong configuration value"))
337 }
338}
324339
=== modified file '_integration-tests/testutils/partition/partition_test.go'
--- _integration-tests/testutils/partition/partition_test.go 2015-10-02 13:10:24 +0000
+++ _integration-tests/testutils/partition/partition_test.go 2015-10-16 00:47:50 +0000
@@ -27,9 +27,9 @@
27)27)
2828
29const (29const (
30 path = "mypath"30 testPath = "mypath"
31 writableCmd = "sudo mount -o remount,rw " + path31 writableCmd = "sudo mount -o remount,rw " + testPath
32 readonlyCmd = "sudo mount -o remount,ro " + path32 readonlyCmd = "sudo mount -o remount,ro " + testPath
33 waitCmd = lsofNotBeingWritten33 waitCmd = lsofNotBeingWritten
34)34)
3535
@@ -86,14 +86,14 @@
86}86}
8787
88func (s *partitionTestSuite) TestMakeWritableCallsExecCommand(c *check.C) {88func (s *partitionTestSuite) TestMakeWritableCallsExecCommand(c *check.C) {
89 err := MakeWritable(c, path)89 err := MakeWritable(c, testPath)
9090
91 c.Assert(err, check.IsNil)91 c.Assert(err, check.IsNil)
92 c.Assert(s.execCalls[writableCmd], check.Equals, 1)92 c.Assert(s.execCalls[writableCmd], check.Equals, 1)
93}93}
9494
95func (s *partitionTestSuite) TestMakeWritableWaitsForIdlePartition(c *check.C) {95func (s *partitionTestSuite) TestMakeWritableWaitsForIdlePartition(c *check.C) {
96 err := MakeWritable(c, path)96 err := MakeWritable(c, testPath)
9797
98 c.Assert(err, check.IsNil)98 c.Assert(err, check.IsNil)
99 c.Assert(s.waitCalls[waitCmd], check.Equals, 1)99 c.Assert(s.waitCalls[waitCmd], check.Equals, 1)
@@ -101,7 +101,7 @@
101101
102func (s *partitionTestSuite) TestMakeWritableReturnsWaitError(c *check.C) {102func (s *partitionTestSuite) TestMakeWritableReturnsWaitError(c *check.C) {
103 s.waitError = true103 s.waitError = true
104 err := MakeWritable(c, path)104 err := MakeWritable(c, testPath)
105105
106 c.Assert(err, check.NotNil)106 c.Assert(err, check.NotNil)
107 c.Assert(s.waitCalls[waitCmd], check.Equals, 1)107 c.Assert(s.waitCalls[waitCmd], check.Equals, 1)
@@ -109,14 +109,14 @@
109}109}
110110
111func (s *partitionTestSuite) TestMakeReadOnlyCallsExecCommand(c *check.C) {111func (s *partitionTestSuite) TestMakeReadOnlyCallsExecCommand(c *check.C) {
112 err := MakeReadonly(c, path)112 err := MakeReadonly(c, testPath)
113113
114 c.Assert(err, check.IsNil)114 c.Assert(err, check.IsNil)
115 c.Assert(s.execCalls[readonlyCmd], check.Equals, 1)115 c.Assert(s.execCalls[readonlyCmd], check.Equals, 1)
116}116}
117117
118func (s *partitionTestSuite) TestMakeReadonlyWaitsForIdlePartition(c *check.C) {118func (s *partitionTestSuite) TestMakeReadonlyWaitsForIdlePartition(c *check.C) {
119 err := MakeReadonly(c, path)119 err := MakeReadonly(c, testPath)
120120
121 c.Assert(err, check.IsNil)121 c.Assert(err, check.IsNil)
122 c.Assert(s.waitCalls[waitCmd], check.Equals, 1)122 c.Assert(s.waitCalls[waitCmd], check.Equals, 1)
@@ -124,7 +124,7 @@
124124
125func (s *partitionTestSuite) TestMakeReadonlyReturnsWaitError(c *check.C) {125func (s *partitionTestSuite) TestMakeReadonlyReturnsWaitError(c *check.C) {
126 s.waitError = true126 s.waitError = true
127 err := MakeReadonly(c, path)127 err := MakeReadonly(c, testPath)
128128
129 c.Assert(err, check.NotNil)129 c.Assert(err, check.NotNil)
130 c.Assert(s.waitCalls[waitCmd], check.Equals, 1)130 c.Assert(s.waitCalls[waitCmd], check.Equals, 1)
@@ -147,7 +147,7 @@
147147
148 for _, testCase := range testCases {148 for _, testCase := range testCases {
149 s.execOutput = testCase.execCommandOutput149 s.execOutput = testCase.execCommandOutput
150 f := checkPathBusyFunc(path)150 f := checkPathBusyFunc(testPath)
151151
152 actual, err := f()152 actual, err := f()
153 c.Check(err, check.IsNil)153 c.Check(err, check.IsNil)
@@ -161,7 +161,7 @@
161 s.execOutput = "not a lsof common output on not used partitions"161 s.execOutput = "not a lsof common output on not used partitions"
162 s.execError = true162 s.execError = true
163163
164 f := checkPathBusyFunc(path)164 f := checkPathBusyFunc(testPath)
165165
166 actual, err := f()166 actual, err := f()
167167

Subscribers

People subscribed via source and target branches