OLD | NEW |
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 apiserver_test | 4 package apiserver_test |
5 | 5 |
6 import ( | 6 import ( |
7 "io" | 7 "io" |
8 . "launchpad.net/gocheck" | 8 . "launchpad.net/gocheck" |
9 "launchpad.net/juju-core/rpc" | 9 "launchpad.net/juju-core/rpc" |
10 "launchpad.net/juju-core/state" | 10 "launchpad.net/juju-core/state" |
(...skipping 25 matching lines...) Expand all Loading... |
36 // s.APIConn. | 36 // s.APIConn. |
37 st, err := api.Open(&api.Info{ | 37 st, err := api.Open(&api.Info{ |
38 Tag: stm.Tag(), | 38 Tag: stm.Tag(), |
39 Password: "password", | 39 Password: "password", |
40 Addrs: []string{srv.Addr()}, | 40 Addrs: []string{srv.Addr()}, |
41 CACert: []byte(coretesting.CACert), | 41 CACert: []byte(coretesting.CACert), |
42 }) | 42 }) |
43 c.Assert(err, IsNil) | 43 c.Assert(err, IsNil) |
44 defer st.Close() | 44 defer st.Close() |
45 | 45 |
46 » _, err = st.Machiner("") | 46 » _, err = st.Machiner() |
47 c.Assert(err, IsNil) | 47 c.Assert(err, IsNil) |
48 | 48 |
49 err = srv.Stop() | 49 err = srv.Stop() |
50 c.Assert(err, IsNil) | 50 c.Assert(err, IsNil) |
51 | 51 |
52 » _, err = st.Machiner("") | 52 » _, err = st.Machiner() |
53 // The client has not necessarily seen the server shutdown yet, | 53 // The client has not necessarily seen the server shutdown yet, |
54 // so there are two possible errors. | 54 // so there are two possible errors. |
55 if err != rpc.ErrShutdown && err != io.ErrUnexpectedEOF { | 55 if err != rpc.ErrShutdown && err != io.ErrUnexpectedEOF { |
56 c.Fatalf("unexpected error from request: %v", err) | 56 c.Fatalf("unexpected error from request: %v", err) |
57 } | 57 } |
58 | 58 |
59 // Check it can be stopped twice. | 59 // Check it can be stopped twice. |
60 err = srv.Stop() | 60 err = srv.Stop() |
61 c.Assert(err, IsNil) | 61 c.Assert(err, IsNil) |
62 } | 62 } |
OLD | NEW |