LEFT | RIGHT |
1 // launchpad.net/juju/go/state | 1 // launchpad.net/juju/go/state |
2 // | 2 // |
3 // Copyright (c) 2011-2012 Canonical Ltd. | 3 // Copyright (c) 2011-2012 Canonical Ltd. |
4 package state_test | 4 package state_test |
5 | 5 |
6 import ( | 6 import ( |
7 "fmt" | 7 "fmt" |
8 . "launchpad.net/gocheck" | 8 . "launchpad.net/gocheck" |
9 "launchpad.net/gozk/zookeeper" | 9 "launchpad.net/gozk/zookeeper" |
10 "launchpad.net/juju/go/charm" | 10 "launchpad.net/juju/go/charm" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 func (s StateSuite) TestAddCharm(c *C) { | 88 func (s StateSuite) TestAddCharm(c *C) { |
89 // Check that adding charms works correctly. | 89 // Check that adding charms works correctly. |
90 dummyCharm := readCharm(c, "dummy") | 90 dummyCharm := readCharm(c, "dummy") |
91 curl := localCharmURL(dummyCharm) | 91 curl := localCharmURL(dummyCharm) |
92 bundleURL, err := url.Parse("http://bundle.url") | 92 bundleURL, err := url.Parse("http://bundle.url") |
93 c.Assert(err, IsNil) | 93 c.Assert(err, IsNil) |
94 dummy, err := s.st.AddCharm(dummyCharm, curl, bundleURL) | 94 dummy, err := s.st.AddCharm(dummyCharm, curl, bundleURL) |
95 c.Assert(err, IsNil) | 95 c.Assert(err, IsNil) |
96 c.Assert(dummy.URL().String(), Equals, curl.String()) | 96 c.Assert(dummy.URL().String(), Equals, curl.String()) |
97 _, _, err = s.zkConn.Children("/charms") | 97 _, _, err = s.zkConn.Children("/charms") |
98 c.Assert(err, IsNil) | |
99 } | |
100 | |
101 func (s StateSuite) TestCharm(c *C) { | |
102 // Check that reading a previously added charm works correctly. | |
103 _, curl := addDummyCharm(c, s.st) | |
104 | |
105 _, err := s.st.Charm(curl) | |
106 c.Assert(err, IsNil) | 98 c.Assert(err, IsNil) |
107 } | 99 } |
108 | 100 |
109 func (s StateSuite) TestCharmAttributes(c *C) { | 101 func (s StateSuite) TestCharmAttributes(c *C) { |
110 // Check that the basic (invariant) fields of the charm | 102 // Check that the basic (invariant) fields of the charm |
111 // are correctly in place. | 103 // are correctly in place. |
112 _, curl := addDummyCharm(c, s.st) | 104 _, curl := addDummyCharm(c, s.st) |
113 | 105 |
114 dummy, err := s.st.Charm(curl) | 106 dummy, err := s.st.Charm(curl) |
115 c.Assert(err, IsNil) | 107 c.Assert(err, IsNil) |
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
637 return err | 629 return err |
638 } | 630 } |
639 for _, child := range children { | 631 for _, child := range children { |
640 if err = zkRemoveTree(zk, fmt.Sprintf("%s/%s", path, child)); er
r != nil { | 632 if err = zkRemoveTree(zk, fmt.Sprintf("%s/%s", path, child)); er
r != nil { |
641 return err | 633 return err |
642 } | 634 } |
643 } | 635 } |
644 // Now delete the path itself. | 636 // Now delete the path itself. |
645 return zk.Delete(path, -1) | 637 return zk.Delete(path, -1) |
646 } | 638 } |
LEFT | RIGHT |