當前位置: 首頁>>代碼示例>>Golang>>正文


Golang testing.AssertStartInstanceWithConstraints函數代碼示例

本文整理匯總了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)
}
開發者ID:exekias,項目名稱:juju,代碼行數:10,代碼來源:local_test.go

示例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))
}
開發者ID:jiasir,項目名稱:juju,代碼行數:12,代碼來源:live_test.go

示例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))
}
開發者ID:bac,項目名稱:juju,代碼行數:12,代碼來源:live_test.go

示例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)
}
開發者ID:AlexisBruemmer,項目名稱:juju,代碼行數:14,代碼來源:suite.go

示例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)
}
開發者ID:bac,項目名稱:juju,代碼行數:14,代碼來源:local_test.go

示例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)
}
開發者ID:klyachin,項目名稱:juju,代碼行數:18,代碼來源:local_test.go


注:本文中的github.com/juju/juju/juju/testing.AssertStartInstanceWithConstraints函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。