本文整理汇总了Golang中github.com/juju/utils/series.LatestLts函数的典型用法代码示例。如果您正苦于以下问题:Golang LatestLts函数的具体用法?Golang LatestLts怎么用?Golang LatestLts使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LatestLts函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: TestPrecheckInstanceUnsupportedArch
func (s *environPolSuite) TestPrecheckInstanceUnsupportedArch(c *gc.C) {
cons := constraints.MustParse("instance-type=n1-standard-1 arch=i386")
placement := ""
err := s.Env.PrecheckInstance(series.LatestLts(), cons, placement)
c.Check(err, jc.ErrorIsNil)
}
开发者ID:xushiwei,项目名称:juju,代码行数:7,代码来源:environ_policy_test.go
示例2: TestPrecheckInstanceInvalidInstanceType
func (s *environPolSuite) TestPrecheckInstanceInvalidInstanceType(c *gc.C) {
cons := constraints.MustParse("instance-type=n1-standard-1.invalid")
placement := ""
err := s.Env.PrecheckInstance(series.LatestLts(), cons, placement)
c.Check(err, gc.ErrorMatches, `.*invalid GCE instance type.*`)
}
开发者ID:xushiwei,项目名称:juju,代码行数:7,代码来源:environ_policy_test.go
示例3: TestDefaultMTUPropagatedToNewLXCBroker
func (s *LXCDefaultMTUSuite) TestDefaultMTUPropagatedToNewLXCBroker(c *gc.C) {
// create a machine to host the container.
m, err := s.BackingState.AddOneMachine(state.MachineTemplate{
Series: series.LatestLts(),
Jobs: []state.MachineJob{state.JobHostUnits},
Constraints: s.defaultConstraints,
})
c.Assert(err, jc.ErrorIsNil)
err = m.SetSupportedContainers([]instance.ContainerType{instance.LXC, instance.KVM})
c.Assert(err, jc.ErrorIsNil)
current := version.Binary{
Number: jujuversion.Current,
Arch: arch.HostArch(),
Series: series.HostSeries(),
}
err = m.SetAgentVersion(current)
c.Assert(err, jc.ErrorIsNil)
brokerCalled := false
newlxcbroker := func(api provisioner.APICalls, agentConfig agent.Config, managerConfig container.ManagerConfig, imageURLGetter container.ImageURLGetter, enableNAT bool, defaultMTU int) (environs.InstanceBroker, error) {
brokerCalled = true
c.Assert(defaultMTU, gc.Equals, 9000)
return nil, fmt.Errorf("lxc broker error")
}
s.PatchValue(&provisioner.NewLxcBroker, newlxcbroker)
s.createContainer(c, m, instance.LXC)
c.Assert(brokerCalled, jc.IsTrue)
}
开发者ID:xushiwei,项目名称:juju,代码行数:28,代码来源:container_initialisation_test.go
示例4: TestContainerInitLockError
func (s *ContainerSetupSuite) TestContainerInitLockError(c *gc.C) {
m, err := s.BackingState.AddOneMachine(state.MachineTemplate{
Series: series.LatestLts(),
Jobs: []state.MachineJob{state.JobHostUnits},
Constraints: s.defaultConstraints,
})
c.Assert(err, jc.ErrorIsNil)
current := version.Binary{
Number: jujuversion.Current,
Arch: arch.HostArch(),
Series: series.HostSeries(),
}
err = m.SetAgentVersion(current)
c.Assert(err, jc.ErrorIsNil)
err = os.RemoveAll(s.initLockDir)
c.Assert(err, jc.ErrorIsNil)
handler, runner := s.setupContainerWorker(c, m.Tag().(names.MachineTag))
runner.Kill()
err = runner.Wait()
c.Assert(err, jc.ErrorIsNil)
_, err = handler.SetUp()
c.Assert(err, jc.ErrorIsNil)
err = handler.Handle(nil, []string{"0/lxc/0"})
c.Assert(err, gc.ErrorMatches, ".*failed to acquire initialization lock:.*")
}
开发者ID:xushiwei,项目名称:juju,代码行数:28,代码来源:container_initialisation_test.go
示例5: TestProvisioningDoesNotOccurForKVM
func (s *ProvisionerSuite) TestProvisioningDoesNotOccurForKVM(c *gc.C) {
p := s.newEnvironProvisioner(c)
defer stop(c, p)
// create a machine to host the container.
m, err := s.addMachine()
c.Assert(err, jc.ErrorIsNil)
inst := s.checkStartInstance(c, m)
// make a container on the machine we just created
template := state.MachineTemplate{
Series: series.LatestLts(),
Jobs: []state.MachineJob{state.JobHostUnits},
}
container, err := s.State.AddMachineInsideMachine(template, m.Id(), instance.KVM)
c.Assert(err, jc.ErrorIsNil)
// the PA should not attempt to create it
s.checkNoOperations(c)
// cleanup
c.Assert(container.EnsureDead(), gc.IsNil)
c.Assert(container.Remove(), gc.IsNil)
c.Assert(m.EnsureDead(), gc.IsNil)
s.checkStopInstances(c, inst)
s.waitForRemovalMark(c, m)
}
开发者ID:bac,项目名称:juju,代码行数:27,代码来源:provisioner_test.go
示例6: TestPrecheckInstanceAvailZone
func (s *environPolSuite) TestPrecheckInstanceAvailZone(c *gc.C) {
cons := constraints.Value{}
placement := "zone=a-zone"
err := s.Env.PrecheckInstance(series.LatestLts(), cons, placement)
c.Check(err, gc.ErrorMatches, `unknown placement directive: .*`)
}
开发者ID:xushiwei,项目名称:juju,代码行数:7,代码来源:environ_policy_test.go
示例7: TestPrecheckInstanceDiskSize
func (s *environPolSuite) TestPrecheckInstanceDiskSize(c *gc.C) {
cons := constraints.MustParse("root-disk=1G")
placement := ""
err := s.Env.PrecheckInstance(series.LatestLts(), cons, placement)
c.Check(err, jc.ErrorIsNil)
}
开发者ID:xushiwei,项目名称:juju,代码行数:7,代码来源:environ_policy_test.go
示例8: TestPrecheckInstanceOkay
func (s *environPolSuite) TestPrecheckInstanceOkay(c *gc.C) {
cons := constraints.Value{}
placement := ""
err := s.Env.PrecheckInstance(series.LatestLts(), cons, placement)
c.Check(err, jc.ErrorIsNil)
}
开发者ID:xushiwei,项目名称:juju,代码行数:7,代码来源:environ_policy_test.go
示例9: TestPrecheckInstanceHasInstanceType
func (s *environPolSuite) TestPrecheckInstanceHasInstanceType(c *gc.C) {
cons := constraints.MustParse("instance-type=some-instance-type")
placement := ""
err := s.Env.PrecheckInstance(series.LatestLts(), cons, placement)
c.Check(err, gc.ErrorMatches, `LXD does not support instance types.*`)
}
开发者ID:xushiwei,项目名称:juju,代码行数:7,代码来源:environ_policy_test.go
示例10: TestPrecheckInstanceAvailZone
func (s *environSuite) TestPrecheckInstanceAvailZone(c *gc.C) {
s.testMAASObject.TestServer.AddZone("zone1", "the grass is greener in zone1")
env := s.makeEnviron()
placement := "zone=zone1"
err := env.PrecheckInstance(series.LatestLts(), constraints.Value{}, placement)
c.Assert(err, jc.ErrorIsNil)
}
开发者ID:bac,项目名称:juju,代码行数:7,代码来源:environ_whitebox_test.go
示例11: TestPrecheckInstanceAvailZoneUnknown
func (s *environSuite) TestPrecheckInstanceAvailZoneUnknown(c *gc.C) {
s.testMAASObject.TestServer.AddZone("zone1", "the grass is greener in zone1")
env := s.makeEnviron()
placement := "zone=zone2"
err := env.PrecheckInstance(series.LatestLts(), constraints.Value{}, placement)
c.Assert(err, gc.ErrorMatches, `invalid availability zone "zone2"`)
}
开发者ID:bac,项目名称:juju,代码行数:7,代码来源:environ_whitebox_test.go
示例12: SetUpTest
func (s *baseProviderSuite) SetUpTest(c *gc.C) {
s.FakeJujuXDGDataHomeSuite.SetUpTest(c)
s.ToolsFixture.SetUpTest(c)
s.PatchValue(&jujuversion.Current, coretesting.FakeVersionNumber)
s.PatchValue(&arch.HostArch, func() string { return arch.AMD64 })
s.PatchValue(&series.HostSeries, func() string { return series.LatestLts() })
}
开发者ID:bac,项目名称:juju,代码行数:7,代码来源:maas_test.go
示例13: TestClientAddMachinesWithInstanceIdSomeErrors
func (s *clientSuite) TestClientAddMachinesWithInstanceIdSomeErrors(c *gc.C) {
apiParams := make([]params.AddMachineParams, 3)
addrs := network.NewAddresses("1.2.3.4")
hc := instance.MustParseHardware("mem=4G")
for i := 0; i < 3; i++ {
apiParams[i] = params.AddMachineParams{
Jobs: []multiwatcher.MachineJob{multiwatcher.JobHostUnits},
InstanceId: instance.Id(fmt.Sprintf("1234-%d", i)),
Nonce: "foo",
HardwareCharacteristics: hc,
Addrs: params.FromNetworkAddresses(addrs...),
}
}
// This will cause the last add-machine to fail.
apiParams[2].Nonce = ""
machines, err := s.APIState.Client().AddMachines(apiParams)
c.Assert(err, jc.ErrorIsNil)
c.Assert(len(machines), gc.Equals, 3)
for i, machineResult := range machines {
if i == 2 {
c.Assert(machineResult.Error, gc.NotNil)
c.Assert(machineResult.Error, gc.ErrorMatches, "cannot add a new machine: cannot add a machine with an instance id and no nonce")
} else {
c.Assert(machineResult.Machine, gc.DeepEquals, strconv.Itoa(i))
s.checkMachine(c, machineResult.Machine, series.LatestLts(), apiParams[i].Constraints.String())
instanceId := fmt.Sprintf("1234-%d", i)
s.checkInstance(c, machineResult.Machine, instanceId, "foo", hc, addrs)
}
}
}
开发者ID:bac,项目名称:juju,代码行数:30,代码来源:client_test.go
示例14: SetUpTest
func (s *rebootSuite) SetUpTest(c *gc.C) {
var err error
template := state.MachineTemplate{
Series: series.LatestLts(),
Jobs: []state.MachineJob{state.JobHostUnits},
}
s.JujuConnSuite.SetUpTest(c)
s.stateAPI, s.machine = s.OpenAPIAsNewMachine(c)
s.rebootState, err = s.stateAPI.Reboot()
c.Assert(err, jc.ErrorIsNil)
c.Assert(s.rebootState, gc.NotNil)
//Add container
s.ct, err = s.State.AddMachineInsideMachine(template, s.machine.Id(), instance.KVM)
c.Assert(err, jc.ErrorIsNil)
password, err := utils.RandomPassword()
c.Assert(err, jc.ErrorIsNil)
err = s.ct.SetPassword(password)
c.Assert(err, jc.ErrorIsNil)
err = s.ct.SetProvisioned("foo", "fake_nonce", nil)
c.Assert(err, jc.ErrorIsNil)
// Open api as container
ctState := s.OpenAPIAsMachine(c, s.ct.Tag(), password, "fake_nonce")
s.ctRebootState, err = ctState.Reboot()
c.Assert(err, jc.ErrorIsNil)
c.Assert(s.ctRebootState, gc.NotNil)
s.clock = &fakeClock{delay: time.Millisecond}
}
开发者ID:bac,项目名称:juju,代码行数:31,代码来源:reboot_test.go
示例15: addMachineWithConstraints
func (s *CommonProvisionerSuite) addMachineWithConstraints(cons constraints.Value) (*state.Machine, error) {
return s.BackingState.AddOneMachine(state.MachineTemplate{
Series: series.LatestLts(),
Jobs: []state.MachineJob{state.JobHostUnits},
Constraints: cons,
})
}
开发者ID:bac,项目名称:juju,代码行数:7,代码来源:provisioner_test.go
示例16: SetUpTest
func (s *ebsSuite) SetUpTest(c *gc.C) {
s.BaseSuite.SetUpTest(c)
s.BaseSuite.PatchValue(&jujuversion.Current, testing.FakeVersionNumber)
s.BaseSuite.PatchValue(&arch.HostArch, func() string { return arch.AMD64 })
s.BaseSuite.PatchValue(&series.HostSeries, func() string { return series.LatestLts() })
s.srv.startServer(c)
s.Tests.SetUpTest(c)
s.PatchValue(&ec2.DestroyVolumeAttempt.Delay, time.Duration(0))
}
开发者ID:kat-co,项目名称:juju,代码行数:9,代码来源:ebs_test.go
示例17: TestPrecheckInstanceUnsupportedArch
func (s *environPolSuite) TestPrecheckInstanceUnsupportedArch(c *gc.C) {
s.PatchValue(&arch.HostArch, func() string { return arch.AMD64 })
cons := constraints.MustParse("arch=i386")
placement := ""
err := s.Env.PrecheckInstance(series.LatestLts(), cons, placement)
c.Check(err, jc.ErrorIsNil)
}
开发者ID:bac,项目名称:juju,代码行数:9,代码来源:environ_policy_test.go
示例18: addContainer
func (s *kvmProvisionerSuite) addContainer(c *gc.C) *state.Machine {
template := state.MachineTemplate{
Series: series.LatestLts(),
Jobs: []state.MachineJob{state.JobHostUnits},
}
container, err := s.State.AddMachineInsideMachine(template, "0", instance.KVM)
c.Assert(err, jc.ErrorIsNil)
return container
}
开发者ID:bac,项目名称:juju,代码行数:9,代码来源:kvm-broker_test.go
示例19: setParams
// setParams sets parameters based on the environment configuration
// for those which have not been explicitly specified.
func (c *imageMetadataCommand) setParams(context *cmd.Context) error {
c.privateStorage = "<private storage name>"
var environ environs.Environ
if environ, err := c.prepare(context); err == nil {
logger.Infof("creating image metadata for model %q", environ.Config().Name())
// If the user has not specified region and endpoint, try and get it from the environment.
if c.Region == "" || c.Endpoint == "" {
var cloudSpec simplestreams.CloudSpec
if inst, ok := environ.(simplestreams.HasRegion); ok {
if cloudSpec, err = inst.Region(); err != nil {
return err
}
} else {
return errors.Errorf("model %q cannot provide region and endpoint", environ.Config().Name())
}
// If only one of region or endpoint is provided, that is a problem.
if cloudSpec.Region != cloudSpec.Endpoint && (cloudSpec.Region == "" || cloudSpec.Endpoint == "") {
return errors.Errorf("cannot generate metadata without a complete cloud configuration")
}
if c.Region == "" {
c.Region = cloudSpec.Region
}
if c.Endpoint == "" {
c.Endpoint = cloudSpec.Endpoint
}
}
cfg := environ.Config()
if c.Series == "" {
c.Series = config.PreferredSeries(cfg)
}
} else {
logger.Warningf("model could not be opened: %v", err)
}
if environ == nil {
logger.Infof("no model found, creating image metadata using user supplied data")
}
if c.Series == "" {
c.Series = series.LatestLts()
}
if c.ImageId == "" {
return errors.Errorf("image id must be specified")
}
if c.Region == "" {
return errors.Errorf("image region must be specified")
}
if c.Endpoint == "" {
return errors.Errorf("cloud endpoint URL must be specified")
}
if c.Dir == "" {
logger.Infof("no destination directory specified, using current directory")
var err error
if c.Dir, err = os.Getwd(); err != nil {
return err
}
}
return nil
}
开发者ID:bac,项目名称:juju,代码行数:59,代码来源:imagemetadata.go
示例20: TestDoesNotStartEnvironMachines
func (s *kvmProvisionerSuite) TestDoesNotStartEnvironMachines(c *gc.C) {
p := s.newKvmProvisioner(c)
defer stop(c, p)
// Check that an instance is not provisioned when the machine is created.
_, err := s.State.AddMachine(series.LatestLts(), state.JobHostUnits)
c.Assert(err, jc.ErrorIsNil)
s.expectNoEvents(c)
}
开发者ID:bac,项目名称:juju,代码行数:10,代码来源:kvm-broker_test.go
注:本文中的github.com/juju/utils/series.LatestLts函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论