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) }
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)) }
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)) }
// 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) }
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) }
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) }