本文整理汇总了Golang中github.com/juju/juju/provider/gce/google.NewZone函数的典型用法代码示例。如果您正苦于以下问题:Golang NewZone函数的具体用法?Golang NewZone怎么用?Golang NewZone使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NewZone函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: TestAvailabilityZones
func (s *environAZSuite) TestAvailabilityZones(c *gc.C) {
s.FakeConn.Zones = []google.AvailabilityZone{
google.NewZone("a-zone", google.StatusUp, "", ""),
google.NewZone("b-zone", google.StatusUp, "", ""),
}
zones, err := s.Env.AvailabilityZones()
c.Assert(err, jc.ErrorIsNil)
c.Check(zones, gc.HasLen, 2)
c.Check(zones[0].Name(), gc.Equals, "a-zone")
c.Check(zones[0].Available(), jc.IsTrue)
c.Check(zones[1].Name(), gc.Equals, "b-zone")
c.Check(zones[1].Available(), jc.IsTrue)
}
开发者ID:imoapps,项目名称:juju,代码行数:16,代码来源:environ_availzones_test.go
示例2: TestParsePlacement
func (s *environInstSuite) TestParsePlacement(c *gc.C) {
zone := google.NewZone("a-zone", google.StatusUp, "", "")
s.FakeConn.Zones = []google.AvailabilityZone{zone}
placement, err := gce.ParsePlacement(s.Env, "zone=a-zone")
c.Assert(err, jc.ErrorIsNil)
c.Check(placement.Zone, jc.DeepEquals, &zone)
}
开发者ID:AlexisBruemmer,项目名称:juju,代码行数:9,代码来源:environ_instance_test.go
示例3: TestParseAvailabilityZonesPlacementUnavailable
func (s *environAZSuite) TestParseAvailabilityZonesPlacementUnavailable(c *gc.C) {
s.StartInstArgs.Placement = "zone=a-zone"
s.FakeConn.Zones = []google.AvailabilityZone{
google.NewZone("a-zone", google.StatusDown, "", ""),
}
_, err := gce.ParseAvailabilityZones(s.Env, s.StartInstArgs)
c.Check(err, gc.ErrorMatches, `.*availability zone "a-zone" is DOWN`)
}
开发者ID:imoapps,项目名称:juju,代码行数:10,代码来源:environ_availzones_test.go
示例4: TestParseAvailabilityZonesPlacement
func (s *environAZSuite) TestParseAvailabilityZonesPlacement(c *gc.C) {
s.StartInstArgs.Placement = "zone=a-zone"
s.FakeConn.Zones = []google.AvailabilityZone{
google.NewZone("a-zone", google.StatusUp, "", ""),
}
zones, err := gce.ParseAvailabilityZones(s.Env, s.StartInstArgs)
c.Assert(err, jc.ErrorIsNil)
c.Check(zones, jc.DeepEquals, []string{"a-zone"})
}
开发者ID:imoapps,项目名称:juju,代码行数:11,代码来源:environ_availzones_test.go
示例5: TestPrecheckInstanceAvailZone
func (s *environPolSuite) TestPrecheckInstanceAvailZone(c *gc.C) {
s.FakeConn.Zones = []google.AvailabilityZone{
google.NewZone("a-zone", google.StatusUp, "", ""),
}
cons := constraints.Value{}
placement := "zone=a-zone"
err := s.Env.PrecheckInstance(testing.FakeDefaultSeries, cons, placement)
c.Check(err, jc.ErrorIsNil)
}
开发者ID:imoapps,项目名称:juju,代码行数:11,代码来源:environ_policy_test.go
示例6: TestPrecheckInstanceAvailZoneUnknown
func (s *environPolSuite) TestPrecheckInstanceAvailZoneUnknown(c *gc.C) {
s.FakeConn.Zones = []google.AvailabilityZone{
google.NewZone("home-zone", google.StatusUp, "", ""),
}
cons := constraints.Value{}
placement := "zone=a-zone"
err := s.Env.PrecheckInstance(series.LatestLts(), cons, placement)
c.Check(err, jc.Satisfies, errors.IsNotFound)
}
开发者ID:xushiwei,项目名称:juju,代码行数:11,代码来源:environ_policy_test.go
示例7: TestPrecheckInstanceAvailZoneUnavailable
func (s *environPolSuite) TestPrecheckInstanceAvailZoneUnavailable(c *gc.C) {
s.FakeConn.Zones = []google.AvailabilityZone{
google.NewZone("a-zone", google.StatusDown, "", ""),
}
cons := constraints.Value{}
placement := "zone=a-zone"
err := s.Env.PrecheckInstance(series.LatestLts(), cons, placement)
c.Check(err, gc.ErrorMatches, `.*availability zone "a-zone" is DOWN`)
}
开发者ID:xushiwei,项目名称:juju,代码行数:11,代码来源:environ_policy_test.go
示例8: TestPrecheckInstanceAPI
func (s *environPolSuite) TestPrecheckInstanceAPI(c *gc.C) {
s.FakeConn.Zones = []google.AvailabilityZone{
google.NewZone("a-zone", google.StatusUp, "", ""),
}
cons := constraints.Value{}
placement := ""
err := s.Env.PrecheckInstance(series.LatestLts(), cons, placement)
c.Assert(err, jc.ErrorIsNil)
c.Check(s.FakeConn.Calls, gc.HasLen, 0)
}
开发者ID:xushiwei,项目名称:juju,代码行数:12,代码来源:environ_policy_test.go
示例9: TestPrecheckInstanceFullAPI
func (s *environPolSuite) TestPrecheckInstanceFullAPI(c *gc.C) {
s.FakeConn.Zones = []google.AvailabilityZone{
google.NewZone("home-zone", google.StatusUp, "", ""),
}
cons := constraints.MustParse("instance-type=n1-standard-1 arch=amd64 root-disk=1G")
placement := "zone=home-zone"
err := s.Env.PrecheckInstance(testing.FakeDefaultSeries, cons, placement)
c.Assert(err, jc.ErrorIsNil)
c.Check(s.FakeConn.Calls, gc.HasLen, 1)
c.Check(s.FakeConn.Calls[0].FuncName, gc.Equals, "AvailabilityZones")
c.Check(s.FakeConn.Calls[0].Region, gc.Equals, "home")
}
开发者ID:imoapps,项目名称:juju,代码行数:14,代码来源:environ_policy_test.go
示例10: TestParseAvailabilityZonesPlacementAPI
func (s *environAZSuite) TestParseAvailabilityZonesPlacementAPI(c *gc.C) {
s.StartInstArgs.Placement = "zone=a-zone"
s.FakeConn.Zones = []google.AvailabilityZone{
google.NewZone("a-zone", google.StatusUp, "", ""),
}
_, err := gce.ParseAvailabilityZones(s.Env, s.StartInstArgs)
c.Assert(err, jc.ErrorIsNil)
s.FakeEnviron.CheckCalls(c, []gce.FakeCall{})
s.FakeCommon.CheckCalls(c, []gce.FakeCall{})
c.Check(s.FakeConn.Calls, gc.HasLen, 1)
c.Check(s.FakeConn.Calls[0].FuncName, gc.Equals, "AvailabilityZones")
c.Check(s.FakeConn.Calls[0].Region, gc.Equals, "home")
}
开发者ID:imoapps,项目名称:juju,代码行数:15,代码来源:environ_availzones_test.go
示例11: TestListVolumesIgnoresNamesFormatteDifferently
func (s *volumeSourceSuite) TestListVolumesIgnoresNamesFormatteDifferently(c *gc.C) {
otherDisk := &google.Disk{
Id: 1234568,
Name: "juju-566fe7b2-c026-4a86-a2cc-84cb7f9a4868",
Zone: "home-zone",
Status: google.StatusReady,
Size: 1024,
Description: "",
}
s.FakeConn.GoogleDisks = []*google.Disk{s.BaseDisk, otherDisk}
s.FakeConn.Zones = []google.AvailabilityZone{google.NewZone("home-zone", "Ready", "", "")}
vols, err := s.source.ListVolumes()
c.Check(err, jc.ErrorIsNil)
c.Assert(vols, gc.HasLen, 1)
}
开发者ID:imoapps,项目名称:juju,代码行数:15,代码来源:disks_test.go
示例12: TestListVolumes
func (s *volumeSourceSuite) TestListVolumes(c *gc.C) {
s.FakeConn.GoogleDisks = []*google.Disk{s.BaseDisk}
s.FakeConn.Zones = []google.AvailabilityZone{google.NewZone("home-zone", "Ready", "", "")}
vols, err := s.source.ListVolumes()
c.Check(err, jc.ErrorIsNil)
c.Assert(vols, gc.HasLen, 1)
azsCalled, call := s.FakeConn.WasCalled("AvailabilityZones")
c.Check(call, gc.HasLen, 1)
c.Assert(azsCalled, jc.IsTrue)
c.Assert(call[0].Region, gc.Equals, "")
disksCalled, call := s.FakeConn.WasCalled("Disks")
c.Check(call, gc.HasLen, 1)
c.Assert(disksCalled, jc.IsTrue)
c.Assert(call[0].ZoneName, gc.Equals, "home-zone")
}
开发者ID:imoapps,项目名称:juju,代码行数:17,代码来源:disks_test.go
示例13: TestAvailabilityZonesDeprecated
func (s *environAZSuite) TestAvailabilityZonesDeprecated(c *gc.C) {
zone := google.NewZone("a-zone", google.StatusUp, "DEPRECATED", "b-zone")
c.Check(zone.Deprecated(), jc.IsTrue)
}
开发者ID:imoapps,项目名称:juju,代码行数:5,代码来源:environ_availzones_test.go
注:本文中的github.com/juju/juju/provider/gce/google.NewZone函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论