Beispiel #1
0
func (s *URLsSuite) TestImageMetadataURLOfficialSource(c *gc.C) {
	// Released streams.
	URL, err := imagemetadata.ImageMetadataURL(imagemetadata.UbuntuCloudImagesURL, "")
	c.Assert(err, gc.IsNil)
	c.Assert(URL, gc.Equals, "http://cloud-images.ubuntu.com/releases")
	URL, err = imagemetadata.ImageMetadataURL(imagemetadata.UbuntuCloudImagesURL, imagemetadata.ReleasedStream)
	c.Assert(err, gc.IsNil)
	c.Assert(URL, gc.Equals, "http://cloud-images.ubuntu.com/releases")
	// Non-released streams.
	URL, err = imagemetadata.ImageMetadataURL(imagemetadata.UbuntuCloudImagesURL, "daily")
	c.Assert(err, gc.IsNil)
	c.Assert(URL, gc.Equals, "http://cloud-images.ubuntu.com/daily")
}
Beispiel #2
0
func (s *URLsSuite) TestImageMetadataURL(c *gc.C) {
	for source, expected := range map[string]string{
		"":           "",
		"foo":        "file://foo/images",
		"/home/foo":  "file:///home/foo/images",
		"file://foo": "file://foo",
		"http://foo": "http://foo",
	} {
		URL, err := imagemetadata.ImageMetadataURL(source, "")
		c.Assert(err, gc.IsNil)
		c.Assert(URL, gc.Equals, expected)
	}
}