Documentation ¶
Index ¶
- type CannedRoundTripper
- type LiveTests
- func (t *LiveTests) BootstrapOnce(c *gc.C)
- func (t *LiveTests) Destroy(c *gc.C)
- func (t *LiveTests) PrepareOnce(c *gc.C)
- func (t *LiveTests) SetUpSuite(c *gc.C)
- func (t *LiveTests) TearDownSuite(c *gc.C)
- func (t *LiveTests) TestBootstrapAndDeploy(c *gc.C)
- func (t *LiveTests) TestBootstrapMultiple(c *gc.C)
- func (t *LiveTests) TestBootstrapVerifyStorage(c *gc.C)
- func (t *LiveTests) TestBootstrapWithDefaultSeries(c *gc.C)
- func (t *LiveTests) TestCheckEnvironmentOnConnect(c *gc.C)
- func (t *LiveTests) TestCheckEnvironmentOnConnectBadVerificationFile(c *gc.C)
- func (t *LiveTests) TestCheckEnvironmentOnConnectNoVerificationFile(c *gc.C)
- func (t *LiveTests) TestFile(c *gc.C)
- func (t *LiveTests) TestGlobalPorts(c *gc.C)
- func (t *LiveTests) TestPorts(c *gc.C)
- func (t *LiveTests) TestPrechecker(c *gc.C)
- func (t *LiveTests) TestStartInstanceWithEmptyNonceFails(c *gc.C)
- func (t *LiveTests) TestStartStop(c *gc.C)
- type ProxyRoundTripper
- type Tests
- Bugs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CannedRoundTripper ¶
type CannedRoundTripper struct {
// contains filtered or unexported fields
}
CannedRoundTripper can be used to provide canned "http" responses without actually starting an HTTP server.
Use this in conjunction with ProxyRoundTripper. A ProxyRoundTripper is what gets registered as the default handler for a given protocol (such as "test") and then tests can direct the ProxyRoundTripper to delegate to a CannedRoundTripper. The reason for this is that we can register a roundtripper to handle a scheme, but there is no way to unregister it: you may need to re-use the same ProxyRoundTripper but use different CannedRoundTrippers to return different results.
func NewCannedRoundTripper ¶
func NewCannedRoundTripper(files map[string]string, errorURLs map[string]int) *CannedRoundTripper
NewCannedRoundTripper returns a CannedRoundTripper with the given canned responses.
type LiveTests ¶
type LiveTests struct { envtesting.ToolsFixture // TestConfig contains the configuration attributes for opening an environment. TestConfig coretesting.Attrs // Attempt holds a strategy for waiting until the environment // becomes logically consistent. Attempt utils.AttemptStrategy // CanOpenState should be true if the testing environment allows // the state to be opened after bootstrapping. CanOpenState bool // HasProvisioner should be true if the environment has // a provisioning agent. HasProvisioner bool // Env holds the currently opened environment. // This is set by PrepareOnce and BootstrapOnce. Env environs.Environ // ConfigStore holds the configuration storage // used when preparing the environment. // This is initialized by SetUpSuite. ConfigStore configstore.Storage // contains filtered or unexported fields }
LiveTests contains tests that are designed to run against a live server (e.g. Amazon EC2). The Environ is opened once only for all the tests in the suite, stored in Env, and Destroyed after the suite has completed.
func (*LiveTests) BootstrapOnce ¶
func (*LiveTests) PrepareOnce ¶
PrepareOnce ensures that the environment is available and prepared. It sets t.Env appropriately.
func (*LiveTests) SetUpSuite ¶
func (*LiveTests) TearDownSuite ¶
func (*LiveTests) TestBootstrapAndDeploy ¶
func (*LiveTests) TestBootstrapMultiple ¶
func (*LiveTests) TestBootstrapVerifyStorage ¶
func (*LiveTests) TestBootstrapWithDefaultSeries ¶
func (*LiveTests) TestCheckEnvironmentOnConnect ¶
func (*LiveTests) TestCheckEnvironmentOnConnectBadVerificationFile ¶
func (*LiveTests) TestCheckEnvironmentOnConnectNoVerificationFile ¶
func (*LiveTests) TestGlobalPorts ¶
func (*LiveTests) TestPrechecker ¶
func (*LiveTests) TestStartInstanceWithEmptyNonceFails ¶
Check that we get a consistent error when asking for an instance without a valid machine config.
func (*LiveTests) TestStartStop ¶
TestStartStop is similar to Tests.TestStartStop except that it does not assume a pristine environment.
type ProxyRoundTripper ¶
type ProxyRoundTripper struct { // Sub is the roundtripper that this roundtripper delegates to, if any. // If you leave this nil, this roundtripper is effectively disabled. Sub http.RoundTripper }
ProxyRoundTripper is an http.RoundTripper implementation that does nothing but delegate to another RoundTripper. This lets tests change how they handle requests for a given scheme, despite the fact that the standard library does not support un-registration, or registration of a new roundtripper with a URL scheme that's already handled.
Use the RegisterForScheme method to install this as the standard handler for a particular protocol. For example, if you call prt.RegisterForScheme("test") then afterwards, any request to "test:///foo" will be routed to prt.
func (*ProxyRoundTripper) RegisterForScheme ¶
func (prt *ProxyRoundTripper) RegisterForScheme(scheme string)
RegisterForScheme registers a ProxyRoundTripper as the default roundtripper for the given URL scheme.
This cannot be undone, nor overwritten with a different roundtripper. If you change your mind later about what the roundtripper should do, set its "Sub" field to delegate to a different roundtripper (or to nil if you don't want to handle its requests at all any more).
type Tests ¶
type Tests struct { TestConfig coretesting.Attrs envtesting.ToolsFixture // ConfigStore holds the configuration storage // used when preparing the environment. // This is initialized by SetUpTest. ConfigStore configstore.Storage }
Tests is a gocheck suite containing tests verifying juju functionality against the environment with the given configuration. The tests are not designed to be run against a live server - the Environ is opened once for each test, and some potentially expensive operations may be executed.
func (*Tests) TearDownTest ¶
func (*Tests) TestBootstrap ¶
func (*Tests) TestPersistence ¶
func (*Tests) TestStartStop ¶
Notes ¶
Bugs ¶
Logic below is very much wrong. Must be:
1. EnsureDying on the unit and EnsureDying on the machine 2. Unit dies by itself 3. Machine removes dead unit 4. Machine dies by itself 5. Provisioner removes dead machine