本文整理汇总了Golang中github.com/juju/juju/state.Charm.URL方法的典型用法代码示例。如果您正苦于以下问题:Golang Charm.URL方法的具体用法?Golang Charm.URL怎么用?Golang Charm.URL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/juju/juju/state.Charm
的用法示例。
在下文中一共展示了Charm.URL方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: assertCustomCharm
func assertCustomCharm(c *gc.C, ch *state.Charm, series string, meta *charm.Meta, config *charm.Config, revision int) {
// Check Charm interface method results.
c.Assert(ch.Meta(), gc.DeepEquals, meta)
c.Assert(ch.Config(), gc.DeepEquals, config)
c.Assert(ch.Revision(), gc.DeepEquals, revision)
// Test URL matches charm and expected series.
url := ch.URL()
c.Assert(url.Series, gc.Equals, series)
c.Assert(url.Revision, gc.Equals, ch.Revision())
// Ignore the BundleURL and BundleSHA256 methods, they're irrelevant.
}
示例2: TestSetCharmConfig
func (s *ServiceSuite) TestSetCharmConfig(c *gc.C) {
charms := map[string]*state.Charm{
stringConfig: s.AddConfigCharm(c, "wordpress", stringConfig, 1),
emptyConfig: s.AddConfigCharm(c, "wordpress", emptyConfig, 2),
floatConfig: s.AddConfigCharm(c, "wordpress", floatConfig, 3),
newStringConfig: s.AddConfigCharm(c, "wordpress", newStringConfig, 4),
}
for i, t := range setCharmConfigTests {
c.Logf("test %d: %s", i, t.summary)
origCh := charms[t.startconfig]
svc := s.AddTestingService(c, "wordpress", origCh)
err := svc.UpdateConfigSettings(t.startvalues)
c.Assert(err, gc.IsNil)
newCh := charms[t.endconfig]
err = svc.SetCharm(newCh, false)
var expectVals charm.Settings
var expectCh *state.Charm
if t.err != "" {
c.Assert(err, gc.ErrorMatches, t.err)
expectCh = origCh
expectVals = t.startvalues
} else {
c.Assert(err, gc.IsNil)
expectCh = newCh
expectVals = t.endvalues
}
sch, _, err := svc.Charm()
c.Assert(err, gc.IsNil)
c.Assert(sch.URL(), gc.DeepEquals, expectCh.URL())
settings, err := svc.ConfigSettings()
c.Assert(err, gc.IsNil)
if len(expectVals) == 0 {
c.Assert(settings, gc.HasLen, 0)
} else {
c.Assert(settings, gc.DeepEquals, expectVals)
}
err = svc.Destroy()
c.Assert(err, gc.IsNil)
}
}