28
28
func (s *S) TestReadMeta(c *C) {
29
meta, err := formula.ReadMeta(repoMeta("dummy"))
29
meta, err := charm.ReadMeta(repoMeta("dummy"))
30
30
c.Assert(err, IsNil)
31
31
c.Assert(meta.Name, Equals, "dummy")
32
32
c.Assert(meta.Revision, Equals, 1)
33
c.Assert(meta.Summary, Equals, "That's a dummy formula.")
33
c.Assert(meta.Summary, Equals, "That's a dummy charm.")
34
34
c.Assert(meta.Description, Equals,
35
35
"This is a longer description which\npotentially contains multiple lines.\n")
38
func (s *S) TestMetaHeader(c *C) {
39
yaml := ReadYaml(repoMeta("dummy"))
40
yaml["ensemble"] = "foo"
41
_, err := formula.ReadMeta(yaml.Reader())
42
c.Assert(err, Matches, `metadata: ensemble: expected "formula", got "foo"`)
45
38
func (s *S) TestParseMetaRelations(c *C) {
46
meta, err := formula.ReadMeta(repoMeta("mysql"))
39
meta, err := charm.ReadMeta(repoMeta("mysql"))
47
40
c.Assert(err, IsNil)
48
c.Assert(meta.Provides["server"], Equals, formula.Relation{Interface: "mysql"})
41
c.Assert(meta.Provides["server"], Equals, charm.Relation{Interface: "mysql"})
49
42
c.Assert(meta.Requires, IsNil)
50
43
c.Assert(meta.Peers, IsNil)
52
meta, err = formula.ReadMeta(repoMeta("riak"))
45
meta, err = charm.ReadMeta(repoMeta("riak"))
53
46
c.Assert(err, IsNil)
54
c.Assert(meta.Provides["endpoint"], Equals, formula.Relation{Interface: "http"})
55
c.Assert(meta.Provides["admin"], Equals, formula.Relation{Interface: "http"})
56
c.Assert(meta.Peers["ring"], Equals, formula.Relation{Interface: "riak", Limit: 1})
47
c.Assert(meta.Provides["endpoint"], Equals, charm.Relation{Interface: "http"})
48
c.Assert(meta.Provides["admin"], Equals, charm.Relation{Interface: "http"})
49
c.Assert(meta.Peers["ring"], Equals, charm.Relation{Interface: "riak", Limit: 1})
57
50
c.Assert(meta.Requires, IsNil)
59
meta, err = formula.ReadMeta(repoMeta("wordpress"))
52
meta, err = charm.ReadMeta(repoMeta("wordpress"))
60
53
c.Assert(err, IsNil)
61
c.Assert(meta.Provides["url"], Equals, formula.Relation{Interface: "http"})
62
c.Assert(meta.Requires["db"], Equals, formula.Relation{Interface: "mysql", Limit: 1})
63
c.Assert(meta.Requires["cache"], Equals, formula.Relation{Interface: "varnish", Limit: 2, Optional: true})
54
c.Assert(meta.Provides["url"], Equals, charm.Relation{Interface: "http"})
55
c.Assert(meta.Requires["db"], Equals, charm.Relation{Interface: "mysql", Limit: 1})
56
c.Assert(meta.Requires["cache"], Equals, charm.Relation{Interface: "varnish", Limit: 2, Optional: true})
64
57
c.Assert(meta.Peers, IsNil)