本文整理汇总了Golang中github.com/juju/juju/juju/testing.PutCharm函数的典型用法代码示例。如果您正苦于以下问题:Golang PutCharm函数的具体用法?Golang PutCharm怎么用?Golang PutCharm使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PutCharm函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: SetUpTest
func (s *DeployLocalSuite) SetUpTest(c *gc.C) {
s.JujuConnSuite.SetUpTest(c)
curl := charm.MustParseURL("local:quantal/dummy")
charm, err := testing.PutCharm(s.State, curl, s.repo, false)
c.Assert(err, jc.ErrorIsNil)
s.charm = charm
}
示例2: addWordpressCharm
func (s *DeployLocalSuite) addWordpressCharm(c *gc.C) *state.Charm {
wordpressCharmURL := charm.MustParseURL("local:quantal/wordpress")
wordpressCharm, err := testing.PutCharm(s.State, wordpressCharmURL, s.repo, false)
c.Assert(err, jc.ErrorIsNil)
return wordpressCharm
}
示例3: addWordpressCharmFromURL
func (s *DeployLocalSuite) addWordpressCharmFromURL(c *gc.C, charmURL *charm.URL) *state.Charm {
wordpressCharm, err := testing.PutCharm(s.State, charmURL, s.repo, false)
c.Assert(err, jc.ErrorIsNil)
return wordpressCharm
}
示例4: TestBootstrapAndDeploy
func (t *LiveTests) TestBootstrapAndDeploy(c *gc.C) {
if !t.CanOpenState || !t.HasProvisioner {
c.Skip(fmt.Sprintf("skipping provisioner test, CanOpenState: %v, HasProvisioner: %v", t.CanOpenState, t.HasProvisioner))
}
t.BootstrapOnce(c)
// TODO(niemeyer): Stop growing this kitchen sink test and split it into proper parts.
c.Logf("opening state")
st := t.Env.(testing.GetStater).GetStateInAPIServer()
c.Logf("opening API connection")
apiState, err := juju.NewAPIState(t.Env, api.DefaultDialOpts())
c.Assert(err, gc.IsNil)
defer apiState.Close()
// Check that the agent version has made it through the
// bootstrap process (it's optional in the config.Config)
cfg, err := st.EnvironConfig()
c.Assert(err, gc.IsNil)
agentVersion, ok := cfg.AgentVersion()
c.Check(ok, gc.Equals, true)
c.Check(agentVersion, gc.Equals, version.Current.Number)
// Check that the constraints have been set in the environment.
cons, err := st.EnvironConstraints()
c.Assert(err, gc.IsNil)
c.Assert(cons.String(), gc.Equals, "mem=2048M")
// Wait for machine agent to come up on the bootstrap
// machine and find the deployed series from that.
m0, err := st.Machine("0")
c.Assert(err, gc.IsNil)
instId0, err := m0.InstanceId()
c.Assert(err, gc.IsNil)
// Check that the API connection is working.
status, err := apiState.Client().Status(nil)
c.Assert(err, gc.IsNil)
c.Assert(status.Machines["0"].InstanceId, gc.Equals, string(instId0))
mw0 := newMachineToolWaiter(m0)
defer mw0.Stop()
// If the series has not been specified, we expect the most recent Ubuntu LTS release to be used.
expectedVersion := version.Current
expectedVersion.Series = config.LatestLtsSeries()
mtools0 := waitAgentTools(c, mw0, expectedVersion)
// Create a new service and deploy a unit of it.
c.Logf("deploying service")
repoDir := c.MkDir()
url := charmtesting.Charms.ClonedURL(repoDir, mtools0.Version.Series, "dummy")
sch, err := testing.PutCharm(st, url, &charm.LocalRepository{Path: repoDir}, false)
c.Assert(err, gc.IsNil)
svc, err := st.AddService("dummy", "user-admin", sch, nil)
c.Assert(err, gc.IsNil)
units, err := juju.AddUnits(st, svc, 1, "")
c.Assert(err, gc.IsNil)
unit := units[0]
// Wait for the unit's machine and associated agent to come up
// and announce itself.
mid1, err := unit.AssignedMachineId()
c.Assert(err, gc.IsNil)
m1, err := st.Machine(mid1)
c.Assert(err, gc.IsNil)
mw1 := newMachineToolWaiter(m1)
defer mw1.Stop()
waitAgentTools(c, mw1, mtools0.Version)
err = m1.Refresh()
c.Assert(err, gc.IsNil)
instId1, err := m1.InstanceId()
c.Assert(err, gc.IsNil)
uw := newUnitToolWaiter(unit)
defer uw.Stop()
utools := waitAgentTools(c, uw, expectedVersion)
// Check that we can upgrade the environment.
newVersion := utools.Version
newVersion.Patch++
t.checkUpgrade(c, st, newVersion, mw0, mw1, uw)
// BUG(niemeyer): Logic below is very much wrong. Must be:
//
// 1. EnsureDying on the unit and EnsureDying on the machine
// 2. Unit dies by itself
// 3. Machine removes dead unit
// 4. Machine dies by itself
// 5. Provisioner removes dead machine
//
// Now remove the unit and its assigned machine and
// check that the PA removes it.
c.Logf("removing unit")
err = unit.Destroy()
c.Assert(err, gc.IsNil)
//.........这里部分代码省略.........