Пример #1
0
func (t *localNonUSEastSuite) SetUpSuite(c *C) {
	t.LoggingSuite.SetUpSuite(c)
	ec2.UseTestImageData(true)
	ec2.UseTestMetadata(true)
	t.tests.SetUpSuite(c)
	ec2.ShortTimeouts(true)
}
Пример #2
0
func (t *localServerSuite) TearDownSuite(c *C) {
	t.Tests.TearDownSuite(c)
	ec2.ShortTimeouts(false)
	ec2.UseTestMetadata(false)
	ec2.UseTestImageData(false)
	t.LoggingSuite.TearDownSuite(c)
}
Пример #3
0
func (s *ProviderSuite) TestMetadata(c *C) {
	metadataContent := []jujutest.FileContent{
		{"/2011-01-01/meta-data/public-hostname", "public.dummy.address.invalid"},
		{"/2011-01-01/meta-data/local-hostname", "private.dummy.address.invalid"},
	}
	ec2.UseTestMetadata(metadataContent)
	defer ec2.UseTestMetadata(nil)

	p, err := environs.Provider("ec2")
	c.Assert(err, IsNil)

	addr, err := p.PublicAddress()
	c.Assert(err, IsNil)
	c.Assert(addr, Equals, "public.dummy.address.invalid")

	addr, err = p.PrivateAddress()
	c.Assert(err, IsNil)
	c.Assert(addr, Equals, "private.dummy.address.invalid")
}
Пример #4
0
func (t *localNonUSEastSuite) TearDownSuite(c *C) {
	ec2.ShortTimeouts(false)
	ec2.UseTestMetadata(false)
	ec2.UseTestImageData(false)
	t.LoggingSuite.TearDownSuite(c)
}