~fwereade/juju-core/unit-remove-depart-scopes

« back to all changes in this revision

Viewing changes to state/api/uniter/state_test.go

  • Committer: William Reade
  • Date: 2013-11-07 17:30:38 UTC
  • mfrom: (2032.1.6 juju-core)
  • Revision ID: fwereade@gmail.com-20131107173038-d0a72q96dujotc0z
merge parent

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
 
6
6
import (
7
7
        gc "launchpad.net/gocheck"
 
8
 
 
9
        "launchpad.net/juju-core/juju/testing"
8
10
)
9
11
 
10
12
type stateSuite struct {
22
24
}
23
25
 
24
26
func (s *stateSuite) TestAPIAddresses(c *gc.C) {
 
27
        testing.AddStateServerMachine(c, s.State)
 
28
 
 
29
        stateAPIAddresses, err := s.State.APIAddresses()
 
30
        c.Assert(err, gc.IsNil)
 
31
        addresses, err := s.uniter.APIAddresses()
 
32
        c.Assert(err, gc.IsNil)
 
33
        c.Assert(addresses, gc.DeepEquals, stateAPIAddresses)
 
34
        // testing.AddStateServerMachine creates a machine which does *not*
 
35
        // match the values in the Environ Config, so these don't match
25
36
        apiInfo := s.APIInfo(c)
 
37
        c.Assert(addresses, gc.Not(gc.DeepEquals), apiInfo.Addrs)
 
38
}
26
39
 
27
 
        addresses, err := s.uniter.APIAddresses()
28
 
        c.Assert(err, gc.IsNil)
29
 
        c.Assert(addresses, gc.DeepEquals, apiInfo.Addrs)
 
40
func (s *stateSuite) TestAPIAddressesFailure(c *gc.C) {
 
41
        _, err := s.uniter.APIAddresses()
 
42
        c.Assert(err, gc.ErrorMatches, "no state server machines found")
30
43
}
31
44
 
32
45
func (s *stateSuite) TestProviderType(c *gc.C) {