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

Side by Side Diff: state/unit_test.go

Issue 7425044: uniter, state: handle upgrades better (Closed)
Patch Set: uniter, state: handle upgrades better 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
OLDNEW
1 package state_test 1 package state_test
2 2
3 import ( 3 import (
4 . "launchpad.net/gocheck" 4 . "launchpad.net/gocheck"
5 "launchpad.net/juju-core/charm" 5 "launchpad.net/juju-core/charm"
6 "launchpad.net/juju-core/state" 6 "launchpad.net/juju-core/state"
7 "sort" 7 "sort"
8 "strconv" 8 "strconv"
9 "time" 9 "time"
10 ) 10 )
(...skipping 22 matching lines...) Expand all
33 c.Assert(err, ErrorMatches, `unit "subway/0" not found`) 33 c.Assert(err, ErrorMatches, `unit "subway/0" not found`)
34 c.Assert(state.IsNotFound(err), Equals, true) 34 c.Assert(state.IsNotFound(err), Equals, true)
35 } 35 }
36 36
37 func (s *UnitSuite) TestService(c *C) { 37 func (s *UnitSuite) TestService(c *C) {
38 svc, err := s.unit.Service() 38 svc, err := s.unit.Service()
39 c.Assert(err, IsNil) 39 c.Assert(err, IsNil)
40 c.Assert(svc.Name(), Equals, s.unit.ServiceName()) 40 c.Assert(svc.Name(), Equals, s.unit.ServiceName())
41 } 41 }
42 42
43 func (s *UnitSuite) TestServiceConfig(c *C) {
44 scfg, err := s.service.Config()
45 c.Assert(err, IsNil)
46 scfg.Update(map[string]interface{}{
47 "foo": "bar",
fwereade 2013/03/14 10:53:54 It's evil and wrong that we can do this in the fir
dimitern 2013/03/14 16:14:39 I agree!
48 "blog-title": "no title",
49 })
50 _, err = scfg.Write()
51 c.Assert(err, IsNil)
52
53 unit, err := s.service.AddUnit()
54
55 _, err = unit.ServiceConfig()
56 c.Assert(err, ErrorMatches, "unit charm not set")
57
58 err = unit.SetCharmURL(s.charm.URL())
59 c.Assert(err, IsNil)
60
61 cfg, err := unit.ServiceConfig()
62 c.Assert(err, IsNil)
63 c.Assert(cfg, DeepEquals, scfg.Map())
64 }
65
43 func (s *UnitSuite) TestGetSetPublicAddress(c *C) { 66 func (s *UnitSuite) TestGetSetPublicAddress(c *C) {
44 address, ok := s.unit.PublicAddress() 67 address, ok := s.unit.PublicAddress()
45 c.Assert(ok, Equals, false) 68 c.Assert(ok, Equals, false)
46 err := s.unit.SetPublicAddress("example.foobar.com") 69 err := s.unit.SetPublicAddress("example.foobar.com")
47 c.Assert(err, IsNil) 70 c.Assert(err, IsNil)
48 address, ok = s.unit.PublicAddress() 71 address, ok = s.unit.PublicAddress()
49 c.Assert(ok, Equals, true) 72 c.Assert(ok, Equals, true)
50 c.Assert(address, Equals, "example.foobar.com") 73 c.Assert(address, Equals, "example.foobar.com")
51 } 74 }
52 75
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 c.Fatalf("got unexpected change: %#v, %v", got, ok) 718 c.Fatalf("got unexpected change: %#v, %v", got, ok)
696 case <-time.After(100 * time.Millisecond): 719 case <-time.After(100 * time.Millisecond):
697 } 720 }
698 } 721 }
699 722
700 func (s *UnitSuite) TestAnnotatorForUnit(c *C) { 723 func (s *UnitSuite) TestAnnotatorForUnit(c *C) {
701 testAnnotator(c, func() (annotator, error) { 724 testAnnotator(c, func() (annotator, error) {
702 return s.State.Unit("wordpress/0") 725 return s.State.Unit("wordpress/0")
703 }) 726 })
704 } 727 }
OLDNEW

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