LEFT | RIGHT |
1 package state_test | 1 package state_test |
2 | 2 |
3 import ( | 3 import ( |
4 "fmt" | 4 "fmt" |
5 . "launchpad.net/gocheck" | 5 . "launchpad.net/gocheck" |
6 "launchpad.net/gozk/zookeeper" | 6 "launchpad.net/gozk/zookeeper" |
7 "launchpad.net/juju-core/charm" | 7 "launchpad.net/juju-core/charm" |
8 "launchpad.net/juju-core/environs/config" | 8 "launchpad.net/juju-core/environs/config" |
9 "launchpad.net/juju-core/juju/testing" | 9 "launchpad.net/juju-core/juju/testing" |
10 "launchpad.net/juju-core/state" | 10 "launchpad.net/juju-core/state" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 func (s *StateSuite) TestInitalizeWithConfig(c *C) { | 85 func (s *StateSuite) TestInitalizeWithConfig(c *C) { |
86 // clean existing state | 86 // clean existing state |
87 coretesting.ZkRemoveTree(s.zkConn, "/") | 87 coretesting.ZkRemoveTree(s.zkConn, "/") |
88 | 88 |
89 m := map[string]interface{}{ | 89 m := map[string]interface{}{ |
90 "name": "only", | 90 "name": "only", |
91 "type": "dummy", | 91 "type": "dummy", |
92 "zookeeper": true, | 92 "zookeeper": true, |
93 "authorized-keys": "i-am-a-key", | 93 "authorized-keys": "i-am-a-key", |
94 "default-series": "precise", | 94 "default-series": "precise", |
| 95 "development": true, |
95 } | 96 } |
96 st, err := state.Initialize(s.StateInfo(c), m) | 97 st, err := state.Initialize(s.StateInfo(c), m) |
97 c.Assert(err, IsNil) | 98 c.Assert(err, IsNil) |
98 c.Assert(st, NotNil) | 99 c.Assert(st, NotNil) |
99 defer st.Close() | 100 defer st.Close() |
100 env, err := st.EnvironConfig() | 101 env, err := st.EnvironConfig() |
101 c.Assert(env.AllAttrs(), DeepEquals, m) | 102 c.Assert(env.AllAttrs(), DeepEquals, m) |
102 } | 103 } |
103 | 104 |
104 type attrs map[string]interface{} | 105 type attrs map[string]interface{} |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 | 164 |
164 select { | 165 select { |
165 case got := <-environConfigWatcher.Changes(): | 166 case got := <-environConfigWatcher.Changes(): |
166 c.Fatalf("got unexpected change: %#v", got) | 167 c.Fatalf("got unexpected change: %#v", got) |
167 case <-time.After(100 * time.Millisecond): | 168 case <-time.After(100 * time.Millisecond): |
168 } | 169 } |
169 } | 170 } |
170 | 171 |
171 func (s *StateSuite) TestAddCharm(c *C) { | 172 func (s *StateSuite) TestAddCharm(c *C) { |
172 // Check that adding charms from scratch works correctly. | 173 // Check that adding charms from scratch works correctly. |
173 » ch := s.CharmDir("series", "dummy") | 174 » ch := s.Repo.Dir("dummy") |
174 curl := charm.MustParseURL( | 175 curl := charm.MustParseURL( |
175 fmt.Sprintf("local:series/%s-%d", ch.Meta().Name, ch.Revision())
, | 176 fmt.Sprintf("local:series/%s-%d", ch.Meta().Name, ch.Revision())
, |
176 ) | 177 ) |
177 bundleURL, err := url.Parse("http://bundles.example.com/dummy-1") | 178 bundleURL, err := url.Parse("http://bundles.example.com/dummy-1") |
178 c.Assert(err, IsNil) | 179 c.Assert(err, IsNil) |
179 dummy, err := s.State.AddCharm(ch, curl, bundleURL, "dummy-1-sha256") | 180 dummy, err := s.State.AddCharm(ch, curl, bundleURL, "dummy-1-sha256") |
180 c.Assert(err, IsNil) | 181 c.Assert(err, IsNil) |
181 c.Assert(dummy.URL().String(), Equals, curl.String()) | 182 c.Assert(dummy.URL().String(), Equals, curl.String()) |
182 children, _, err := s.zkConn.Children("/charms") | 183 children, _, err := s.zkConn.Children("/charms") |
183 c.Assert(err, IsNil) | 184 c.Assert(err, IsNil) |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 func (*StateSuite) TestSortPorts(c *C) { | 480 func (*StateSuite) TestSortPorts(c *C) { |
480 for _, t := range sortPortsTests { | 481 for _, t := range sortPortsTests { |
481 p := make([]state.Port, len(t.have)) | 482 p := make([]state.Port, len(t.have)) |
482 copy(p, t.have) | 483 copy(p, t.have) |
483 state.SortPorts(p) | 484 state.SortPorts(p) |
484 c.Check(p, DeepEquals, t.want) | 485 c.Check(p, DeepEquals, t.want) |
485 state.SortPorts(p) | 486 state.SortPorts(p) |
486 c.Check(p, DeepEquals, t.want) | 487 c.Check(p, DeepEquals, t.want) |
487 } | 488 } |
488 } | 489 } |
LEFT | RIGHT |