本文整理汇总了Golang中github.com/juju/juju/environs/simplestreams.HasCloud函数的典型用法代码示例。如果您正苦于以下问题:Golang HasCloud函数的具体用法?Golang HasCloud怎么用?Golang HasCloud使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了HasCloud函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: TestHasCloudFindsMatchWithTrailingSlash
func (*simplestreamsSuite) TestHasCloudFindsMatchWithTrailingSlash(c *gc.C) {
metadata := simplestreams.IndexMetadata{
Clouds: []simplestreams.CloudSpec{
{Region: "r1", Endpoint: "http://e1/"},
{Region: "r2", Endpoint: "http://e2"},
},
}
spec := simplestreams.CloudSpec{Region: "r1", Endpoint: "http://e1"}
c.Check(simplestreams.HasCloud(metadata, spec), jc.IsTrue)
spec = simplestreams.CloudSpec{Region: "r1", Endpoint: "http://e1/"}
c.Check(simplestreams.HasCloud(metadata, spec), jc.IsTrue)
spec = simplestreams.CloudSpec{Region: "r2", Endpoint: "http://e2/"}
c.Check(simplestreams.HasCloud(metadata, spec), jc.IsTrue)
}
示例2: TestHasCloudFindsMatch
func (*simplestreamsSuite) TestHasCloudFindsMatch(c *gc.C) {
metadata := simplestreams.IndexMetadata{
Clouds: []simplestreams.CloudSpec{
{Region: "r1", Endpoint: "http://e1"},
{Region: "r2", Endpoint: "http://e2"},
},
}
c.Check(simplestreams.HasCloud(metadata, metadata.Clouds[1]), jc.IsTrue)
}
示例3: TestHasCloudReturnsFalseIfCloudsDoNotMatch
func (*simplestreamsSuite) TestHasCloudReturnsFalseIfCloudsDoNotMatch(c *gc.C) {
metadata := simplestreams.IndexMetadata{
Clouds: []simplestreams.CloudSpec{
{Region: "r1", Endpoint: "http://e1"},
{Region: "r2", Endpoint: "http://e2"},
},
}
otherCloud := simplestreams.CloudSpec{Region: "r9", Endpoint: "http://e9"}
c.Check(simplestreams.HasCloud(metadata, otherCloud), jc.IsFalse)
}
示例4: TestHasCloudRequiresIdenticalEndpoint
func (*simplestreamsSuite) TestHasCloudRequiresIdenticalEndpoint(c *gc.C) {
metadata := simplestreams.IndexMetadata{
Clouds: []simplestreams.CloudSpec{
{Region: "around", Endpoint: "http://nearby"},
},
}
similarCloud := metadata.Clouds[0]
similarCloud.Endpoint = "http://far"
c.Assert(similarCloud, gc.Not(gc.Equals), metadata.Clouds[0])
c.Check(simplestreams.HasCloud(metadata, similarCloud), jc.IsFalse)
}
示例5: TestHasCloudAcceptsNil
func (*simplestreamsSuite) TestHasCloudAcceptsNil(c *gc.C) {
metadata := simplestreams.IndexMetadata{Clouds: nil}
c.Check(simplestreams.HasCloud(metadata, simplestreams.CloudSpec{}), jc.IsTrue)
}