本文整理匯總了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)
}