本文整理汇总了Golang中github.com/juju/juju/juju/testing.AssertStartInstanceWithConstraints函数的典型用法代码示例。如果您正苦于以下问题:Golang AssertStartInstanceWithConstraints函数的具体用法?Golang AssertStartInstanceWithConstraints怎么用?Golang AssertStartInstanceWithConstraints使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了AssertStartInstanceWithConstraints函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: TestStartInstanceHardwareCharacteristics
func (s *localServerSuite) TestStartInstanceHardwareCharacteristics(c *gc.C) {
env := s.Prepare(c)
err := bootstrap.Bootstrap(bootstrapContext(c), env, bootstrap.BootstrapParams{})
c.Assert(err, jc.ErrorIsNil)
_, hc := testing.AssertStartInstanceWithConstraints(c, env, "100", constraints.MustParse("mem=1024"))
c.Check(*hc.Arch, gc.Equals, "amd64")
c.Check(*hc.Mem, gc.Equals, uint64(1024))
c.Check(*hc.CpuCores, gc.Equals, uint64(1))
c.Assert(hc.CpuPower, gc.IsNil)
}
示例2: TestStartInstanceConstraints
func (t *LiveTests) TestStartInstanceConstraints(c *gc.C) {
cons := constraints.MustParse("mem=2G")
inst, hc := testing.AssertStartInstanceWithConstraints(c, t.Env, "30", cons)
defer t.Env.StopInstances(inst.Id())
ec2inst := ec2.InstanceEC2(inst)
c.Assert(ec2inst.InstanceType, gc.Equals, "m1.medium")
c.Assert(*hc.Arch, gc.Equals, "amd64")
c.Assert(*hc.Mem, gc.Equals, uint64(3840))
c.Assert(*hc.RootDisk, gc.Equals, uint64(8192))
c.Assert(*hc.CpuCores, gc.Equals, uint64(1))
c.Assert(*hc.CpuPower, gc.Equals, uint64(200))
}
示例3: TestStartInstanceConstraints
func (t *LiveTests) TestStartInstanceConstraints(c *gc.C) {
t.PrepareOnce(c)
cons := constraints.MustParse("mem=4G")
inst, hc := testing.AssertStartInstanceWithConstraints(c, t.Env, t.ControllerUUID, "30", cons)
defer t.Env.StopInstances(inst.Id())
ec2inst := ec2.InstanceEC2(inst)
c.Assert(ec2inst.InstanceType, gc.Equals, "m4.large")
c.Assert(*hc.Arch, gc.Equals, "amd64")
c.Assert(*hc.Mem, gc.Equals, uint64(8*1024))
c.Assert(*hc.RootDisk, gc.Equals, uint64(8*1024))
c.Assert(*hc.CpuCores, gc.Equals, uint64(2))
}
示例4: AddMachine
// AddMachine adds a new machine to state.
func (s *CharmSuite) AddMachine(c *gc.C, machineId string, job state.MachineJob) {
m, err := s.jcSuite.State.AddOneMachine(state.MachineTemplate{
Series: "quantal",
Jobs: []state.MachineJob{job},
})
c.Assert(err, jc.ErrorIsNil)
c.Assert(m.Id(), gc.Equals, machineId)
cons, err := m.Constraints()
c.Assert(err, jc.ErrorIsNil)
inst, hc := jujutesting.AssertStartInstanceWithConstraints(c, s.jcSuite.Environ, m.Id(), cons)
err = m.SetProvisioned(inst.Id(), "fake_nonce", hc)
c.Assert(err, jc.ErrorIsNil)
}
示例5: TestStartInstanceHardwareCharacteristics
func (s *localServerSuite) TestStartInstanceHardwareCharacteristics(c *gc.C) {
env := s.Prepare(c)
err := bootstrap.Bootstrap(bootstrapContext(c), env, bootstrap.BootstrapParams{
ControllerConfig: coretesting.FakeControllerConfig(),
AdminSecret: testing.AdminSecret,
CAPrivateKey: coretesting.CAKey,
})
c.Assert(err, jc.ErrorIsNil)
_, hc := testing.AssertStartInstanceWithConstraints(c, env, s.ControllerUUID, "100", constraints.MustParse("mem=1024"))
c.Check(*hc.Arch, gc.Equals, "amd64")
c.Check(*hc.Mem, gc.Equals, uint64(1024))
c.Check(*hc.CpuCores, gc.Equals, uint64(1))
c.Assert(hc.CpuPower, gc.IsNil)
}
示例6: TestStartInstanceHardwareCharacteristics
func (s *localServerSuite) TestStartInstanceHardwareCharacteristics(c *gc.C) {
// Ensure amd64 tools are available, to ensure an amd64 image.
amd64Version := version.Current
amd64Version.Arch = arch.AMD64
for _, series := range bootstrap.ToolsLtsSeries {
amd64Version.Series = series
envtesting.AssertUploadFakeToolsVersions(c, s.toolsMetadataStorage, amd64Version)
}
env := s.Prepare(c)
err := bootstrap.Bootstrap(coretesting.Context(c), env, environs.BootstrapParams{})
c.Assert(err, gc.IsNil)
_, hc := testing.AssertStartInstanceWithConstraints(c, env, "100", constraints.MustParse("mem=1024"))
c.Check(*hc.Arch, gc.Equals, "amd64")
c.Check(*hc.Mem, gc.Equals, uint64(2048))
c.Check(*hc.CpuCores, gc.Equals, uint64(1))
c.Assert(hc.CpuPower, gc.IsNil)
}