Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(2)

Side by Side Diff: worker/machiner/machiner_test.go

Issue 8416043: trivial: worker.ErrDead -> ErrTerminateAgent (Closed)
Patch Set: trivial: worker.ErrDead -> ErrTerminateAgent Created 12 years ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « worker/machiner/machiner.go ('k') | worker/uniter/filter.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 package machiner_test 1 package machiner_test
2 2
3 import ( 3 import (
4 . "launchpad.net/gocheck" 4 . "launchpad.net/gocheck"
5 "launchpad.net/juju-core/juju/testing" 5 "launchpad.net/juju-core/juju/testing"
6 "launchpad.net/juju-core/state" 6 "launchpad.net/juju-core/state"
7 coretesting "launchpad.net/juju-core/testing" 7 coretesting "launchpad.net/juju-core/testing"
8 "launchpad.net/juju-core/worker" 8 "launchpad.net/juju-core/worker"
9 "launchpad.net/juju-core/worker/machiner" 9 "launchpad.net/juju-core/worker/machiner"
10 stdtesting "testing" 10 stdtesting "testing"
11 ) 11 )
12 12
13 func TestPackage(t *stdtesting.T) { 13 func TestPackage(t *stdtesting.T) {
14 coretesting.MgoTestPackage(t) 14 coretesting.MgoTestPackage(t)
15 } 15 }
16 16
17 type MachinerSuite struct { 17 type MachinerSuite struct {
18 testing.JujuConnSuite 18 testing.JujuConnSuite
19 } 19 }
20 20
21 var _ = Suite(&MachinerSuite{}) 21 var _ = Suite(&MachinerSuite{})
22 22
23 func (s *MachinerSuite) TestNotFound(c *C) { 23 func (s *MachinerSuite) TestNotFound(c *C) {
24 mr := machiner.NewMachiner(s.State, "eleventy-one") 24 mr := machiner.NewMachiner(s.State, "eleventy-one")
25 » c.Assert(mr.Wait(), Equals, worker.ErrDead) 25 » c.Assert(mr.Wait(), Equals, worker.ErrTerminateAgent)
26 } 26 }
27 27
28 func (s *MachinerSuite) TestRunStop(c *C) { 28 func (s *MachinerSuite) TestRunStop(c *C) {
29 m, err := s.State.AddMachine("series", state.JobHostUnits) 29 m, err := s.State.AddMachine("series", state.JobHostUnits)
30 c.Assert(err, IsNil) 30 c.Assert(err, IsNil)
31 mr := machiner.NewMachiner(s.State, m.Id()) 31 mr := machiner.NewMachiner(s.State, m.Id())
32 c.Assert(mr.Stop(), IsNil) 32 c.Assert(mr.Stop(), IsNil)
33 c.Assert(m.Refresh(), IsNil) 33 c.Assert(m.Refresh(), IsNil)
34 c.Assert(m.Life(), Equals, state.Alive) 34 c.Assert(m.Life(), Equals, state.Alive)
35 } 35 }
36 36
37 func (s *MachinerSuite) TestSetDead(c *C) { 37 func (s *MachinerSuite) TestSetDead(c *C) {
38 m, err := s.State.AddMachine("series", state.JobHostUnits) 38 m, err := s.State.AddMachine("series", state.JobHostUnits)
39 c.Assert(err, IsNil) 39 c.Assert(err, IsNil)
40 mr := machiner.NewMachiner(s.State, m.Id()) 40 mr := machiner.NewMachiner(s.State, m.Id())
41 defer mr.Stop() 41 defer mr.Stop()
42 c.Assert(m.Destroy(), IsNil) 42 c.Assert(m.Destroy(), IsNil)
43 s.State.StartSync() 43 s.State.StartSync()
44 » c.Assert(mr.Wait(), Equals, worker.ErrDead) 44 » c.Assert(mr.Wait(), Equals, worker.ErrTerminateAgent)
45 c.Assert(m.Refresh(), IsNil) 45 c.Assert(m.Refresh(), IsNil)
46 c.Assert(m.Life(), Equals, state.Dead) 46 c.Assert(m.Life(), Equals, state.Dead)
47 } 47 }
OLDNEW
« no previous file with comments | « worker/machiner/machiner.go ('k') | worker/uniter/filter.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b