本文整理匯總了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)
}
}