jujutest

package
v0.0.0-...-acd7349 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 11, 2013 License: AGPL-3.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileContent

type FileContent struct {
	Name    string
	Content string
}

A simple content structure to pass data into VirtualRoundTripper. When using VRT, requests that match 'Name' will be served the value in 'Content'

type LiveTests

type LiveTests struct {
	coretesting.LoggingSuite

	// TestConfig contains the configuration attributes for opening an environment.
	TestConfig TestConfig

	// Env holds the currently opened environment.
	Env environs.Environ

	// 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
	// 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 (t *LiveTests) BootstrapOnce(c *C)

func (*LiveTests) Destroy

func (t *LiveTests) Destroy(c *C)

func (*LiveTests) SetUpSuite

func (t *LiveTests) SetUpSuite(c *C)

func (*LiveTests) TearDownSuite

func (t *LiveTests) TearDownSuite(c *C)

func (*LiveTests) TestBootstrapAndDeploy

func (t *LiveTests) TestBootstrapAndDeploy(c *C)

func (*LiveTests) TestBootstrapMultiple

func (t *LiveTests) TestBootstrapMultiple(c *C)

func (*LiveTests) TestBootstrapVerifyStorage

func (t *LiveTests) TestBootstrapVerifyStorage(c *C)

func (*LiveTests) TestBootstrapWithDefaultSeries

func (t *LiveTests) TestBootstrapWithDefaultSeries(c *C)

func (*LiveTests) TestCheckEnvironmentOnConnect

func (t *LiveTests) TestCheckEnvironmentOnConnect(c *C)

func (*LiveTests) TestCheckEnvironmentOnConnectBadVerificationFile

func (t *LiveTests) TestCheckEnvironmentOnConnectBadVerificationFile(c *C)

func (*LiveTests) TestCheckEnvironmentOnConnectNoVerificationFile

func (t *LiveTests) TestCheckEnvironmentOnConnectNoVerificationFile(c *C)

func (*LiveTests) TestFile

func (t *LiveTests) TestFile(c *C)

func (*LiveTests) TestGlobalPorts

func (t *LiveTests) TestGlobalPorts(c *C)

func (*LiveTests) TestPorts

func (t *LiveTests) TestPorts(c *C)

func (*LiveTests) TestStartInstanceOnUnknownPlatform

func (t *LiveTests) TestStartInstanceOnUnknownPlatform(c *C)

Check that we can't start an instance running tools that correspond with no available platform. The first thing start instance should do is find appropriate tools.

func (*LiveTests) TestStartInstanceWithEmptyNonceFails

func (t *LiveTests) TestStartInstanceWithEmptyNonceFails(c *C)

Check that we can't start an instance with an empty nonce value.

func (*LiveTests) TestStartStop

func (t *LiveTests) TestStartStop(c *C)

TestStartStop is similar to Tests.TestStartStop except that it does not assume a pristine environment.

type ProxyRoundTripper

type ProxyRoundTripper struct {
	Sub http.RoundTripper
}

When using RegisterProtocol on http.Transport, you can't actually change the registration. So we provide a RoundTripper that simply proxies to whatever we want as the current content.

func (*ProxyRoundTripper) RoundTrip

func (prt *ProxyRoundTripper) RoundTrip(req *http.Request) (*http.Response, error)

type TestConfig

type TestConfig struct {
	Config map[string]interface{}
}

TestConfig contains the configuration for the environment This is a is an indirection to make it harder for tests to accidentally share the underlying map.

func (*TestConfig) UpdateConfig

func (testConfig *TestConfig) UpdateConfig(update map[string]interface{})

UpdateConfig modifies the configuration safely by creating a new map

type Tests

type Tests struct {
	coretesting.LoggingSuite
	TestConfig TestConfig
	Env        environs.Environ
}

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) Open

func (t *Tests) Open(c *C) environs.Environ

Open opens an instance of the testing environment.

func (*Tests) SetUpTest

func (t *Tests) SetUpTest(c *C)

func (*Tests) TearDownTest

func (t *Tests) TearDownTest(c *C)

func (*Tests) TestBootstrap

func (t *Tests) TestBootstrap(c *C)

func (*Tests) TestPersistence

func (t *Tests) TestPersistence(c *C)

func (*Tests) TestStartStop

func (t *Tests) TestStartStop(c *C)

type VirtualRoundTripper

type VirtualRoundTripper struct {
	// contains filtered or unexported fields
}

VirtualRoundTripper can be used to provide "http" responses without actually starting an HTTP server. It is used by calling: vfs := NewVirtualRoundTripper([]FileContent{<file contents>, <error urls>}) http.DefaultTransport.(*http.Transport).RegisterProtocol("test", vfs) At which point requests to test:///foo will pull out the virtual content of the file named 'foo' passed into the RoundTripper constructor. If errorURLs are supplied, any URL which starts with the one of the map keys causes a response with the corresponding status code to be returned.

func NewVirtualRoundTripper

func NewVirtualRoundTripper(contents []FileContent, errorURLs map[string]int) *VirtualRoundTripper

func (*VirtualRoundTripper) RoundTrip

func (v *VirtualRoundTripper) RoundTrip(req *http.Request) (*http.Response, error)

Map the Path into Content based on FileContent.Name

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL