當前位置: 首頁>>代碼示例>>Golang>>正文


Golang simplestreams.HasCloud函數代碼示例

本文整理匯總了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)
}
開發者ID:kapilt,項目名稱:juju,代碼行數:14,代碼來源:simplestreams_test.go

示例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)
}
開發者ID:kapilt,項目名稱:juju,代碼行數:9,代碼來源:simplestreams_test.go

示例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)
}
開發者ID:kapilt,項目名稱:juju,代碼行數:10,代碼來源:simplestreams_test.go

示例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)
}
開發者ID:kapilt,項目名稱:juju,代碼行數:12,代碼來源:simplestreams_test.go

示例5: TestHasCloudAcceptsNil

func (*simplestreamsSuite) TestHasCloudAcceptsNil(c *gc.C) {
	metadata := simplestreams.IndexMetadata{Clouds: nil}
	c.Check(simplestreams.HasCloud(metadata, simplestreams.CloudSpec{}), jc.IsTrue)
}
開發者ID:kapilt,項目名稱:juju,代碼行數:4,代碼來源:simplestreams_test.go


注:本文中的github.com/juju/juju/environs/simplestreams.HasCloud函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。