LEFT | RIGHT |
(no file at all) | |
1 // Copyright 2012, 2013 Canonical Ltd. | 1 // Copyright 2012, 2013 Canonical Ltd. |
2 // Licensed under the AGPLv3, see LICENCE file for details. | 2 // Licensed under the AGPLv3, see LICENCE file for details. |
3 | 3 |
4 package uniter_test | 4 package uniter_test |
5 | 5 |
6 import ( | 6 import ( |
7 "bytes" | 7 "bytes" |
8 "crypto/sha256" | 8 "crypto/sha256" |
9 "encoding/hex" | 9 "encoding/hex" |
10 "fmt" | 10 "fmt" |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 resolveError{state.ResolvedRetryHooks}, | 322 resolveError{state.ResolvedRetryHooks}, |
323 waitUnit{ | 323 waitUnit{ |
324 status: params.StatusStarted, | 324 status: params.StatusStarted, |
325 }, | 325 }, |
326 waitHooks{"start", "config-changed"}, | 326 waitHooks{"start", "config-changed"}, |
327 verifyRunning{}, | 327 verifyRunning{}, |
328 ), | 328 ), |
329 } | 329 } |
330 | 330 |
331 func (s *UniterSuite) TestUniterStartHook(c *C) { | 331 func (s *UniterSuite) TestUniterStartHook(c *C) { |
| 332 s.runUniterTests(c, startHookTests) |
| 333 } |
| 334 |
| 335 var multipleErrorsTests = []uniterTest{ |
| 336 ut( |
| 337 "resolved is cleared before moving on to next hook", |
| 338 createCharm{badHooks: []string{"install", "config-changed", "sta
rt"}}, |
| 339 serveCharm{}, |
| 340 createUniter{}, |
| 341 waitUnit{ |
| 342 status: params.StatusError, |
| 343 info: `hook failed: "install"`, |
| 344 }, |
| 345 resolveError{state.ResolvedNoHooks}, |
| 346 waitUnit{ |
| 347 status: params.StatusError, |
| 348 info: `hook failed: "config-changed"`, |
| 349 }, |
| 350 resolveError{state.ResolvedNoHooks}, |
| 351 waitUnit{ |
| 352 status: params.StatusError, |
| 353 info: `hook failed: "start"`, |
| 354 }, |
| 355 ), |
| 356 } |
| 357 |
| 358 func (s *UniterSuite) TestUniterMultipleErrors(c *C) { |
332 s.runUniterTests(c, startHookTests) | 359 s.runUniterTests(c, startHookTests) |
333 } | 360 } |
334 | 361 |
335 var configChangedHookTests = []uniterTest{ | 362 var configChangedHookTests = []uniterTest{ |
336 ut( | 363 ut( |
337 "config-changed hook fail and resolve", | 364 "config-changed hook fail and resolve", |
338 startupError{"config-changed"}, | 365 startupError{"config-changed"}, |
339 verifyWaiting{}, | 366 verifyWaiting{}, |
340 | 367 |
341 // Note: we'll run another config-changed as soon as we hit the | 368 // Note: we'll run another config-changed as soon as we hit the |
(...skipping 1366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1708 | 1735 |
1709 var verifyHookSyncLockUnlocked = custom{func(c *C, ctx *context) { | 1736 var verifyHookSyncLockUnlocked = custom{func(c *C, ctx *context) { |
1710 lock := createHookLock(c, ctx.dataDir) | 1737 lock := createHookLock(c, ctx.dataDir) |
1711 c.Assert(lock.IsLocked(), Equals, false) | 1738 c.Assert(lock.IsLocked(), Equals, false) |
1712 }} | 1739 }} |
1713 | 1740 |
1714 var verifyHookSyncLockLocked = custom{func(c *C, ctx *context) { | 1741 var verifyHookSyncLockLocked = custom{func(c *C, ctx *context) { |
1715 lock := createHookLock(c, ctx.dataDir) | 1742 lock := createHookLock(c, ctx.dataDir) |
1716 c.Assert(lock.IsLocked(), Equals, true) | 1743 c.Assert(lock.IsLocked(), Equals, true) |
1717 }} | 1744 }} |
LEFT | RIGHT |