Example #1
0
func UseTestMetadata(content []jujutest.FileContent) {
	if content != nil {
		testRoundTripper.Sub = jujutest.NewVirtualRoundTripper(content, nil)
		metadataHost = "test:"
	} else {
		testRoundTripper.Sub = nil
		metadataHost = origMetadataHost
	}
}
Example #2
0
// Set Metadata requests to be served by the filecontent supplied.
func UseTestMetadata(metadata []jujutest.FileContent) {
	if len(metadata) != 0 {
		testRoundTripper.Sub = jujutest.NewVirtualRoundTripper(metadata, nil)
		metadataHost = "test:"
	} else {
		testRoundTripper.Sub = nil
		metadataHost = origMetadataHost
	}
}
Example #3
0
// UseTestImageData causes the given content to be served
// when the ec2 client asks for image data.
func UseTestImageData(content []jujutest.FileContent) {
	if content != nil {
		testRoundTripper.Sub = jujutest.NewVirtualRoundTripper(content, nil)
		imagemetadata.DefaultBaseURL = "test:"
		signedImageDataOnly = false
	} else {
		signedImageDataOnly = true
		testRoundTripper.Sub = nil
		imagemetadata.DefaultBaseURL = origImagesUrl
	}
}
Example #4
0
func (s *BootstrapSuite) SetUpSuite(c *C) {
	s.LoggingSuite.SetUpSuite(c)
	s.MgoSuite.SetUpSuite(c)
	stateInfo := environs.BootstrapState{
		StateInstances: []instance.Id{instance.Id("dummy.instance.id")},
	}
	stateData, err := goyaml.Marshal(stateInfo)
	c.Assert(err, IsNil)
	testRoundTripper.Sub = jujutest.NewVirtualRoundTripper([]jujutest.FileContent{
		{"/" + environs.StateFile, string(stateData)},
	}, nil)
	s.providerStateURLFile = filepath.Join(c.MkDir(), "provider-state-url")
	providerStateURLFile = s.providerStateURLFile
}
Example #5
0
func (s *simplestreamsSuite) SetUpSuite(c *C) {
	s.liveSimplestreamsSuite.SetUpSuite(c)
	testRoundTripper.Sub = jujutest.NewVirtualRoundTripper(
		imageData, map[string]int{"test://unauth": http.StatusUnauthorized})
}