jujutest

package
v0.0.0-...-298751d Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: AGPL-3.0 Imports: 49 Imported by: 6

Documentation

Index

Constants

View Source
const (
	AdminSecret = "admin-secret"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type LiveTests

type LiveTests struct {
	gitjujutesting.CleanupSuite

	envtesting.ToolsFixture
	sstesting.TestDataSuite

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

	// Credential contains the credential for preparing an environment for
	// bootstrapping. If this is unset, empty credentials will be used.
	Credential cloud.Credential

	// CloudRegion contains the cloud region name to create resources in.
	CloudRegion string

	// CloudEndpoint contains the cloud API endpoint to communicate with.
	CloudEndpoint string

	// Attempt holds a strategy for waiting until the environment
	// becomes logically consistent.
	//
	// TODO(katco): 2016-08-09: lp:1611427
	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

	// ControllerStore holds the controller related information
	// such as controllers, accounts, etc., used when preparing
	// the environment. This is initialized by SetUpSuite.
	ControllerStore jujuclient.ClientStore

	// ControllerUUID is the uuid of the bootstrapped controller.
	ControllerUUID string

	// ProviderCallContext holds the context to be used to make
	// calls to a cloud provider.
	ProviderCallContext context.ProviderCallContext

	// BootstrapContext holds the context to bootstrap a test environment.
	BootstrapContext environs.BootstrapContext
	// 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 *gc.C)

func (*LiveTests) Destroy

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

func (*LiveTests) PrepareOnce

func (t *LiveTests) PrepareOnce(c *gc.C)

PrepareOnce ensures that the environment is available and prepared. It sets t.Env appropriately.

func (*LiveTests) SetUpSuite

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

func (*LiveTests) SetUpTest

func (t *LiveTests) SetUpTest(c *gc.C)

func (*LiveTests) TearDownSuite

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

func (*LiveTests) TearDownTest

func (t *LiveTests) TearDownTest(c *gc.C)

func (*LiveTests) TestBootstrapAndDeploy

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

func (*LiveTests) TestBootstrapMultiple

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

func (*LiveTests) TestBootstrapWithDefaultSeries

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

func (*LiveTests) TestGlobalPorts

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

func (*LiveTests) TestIngressRulesWithPartiallyMatchingCIDRs

func (t *LiveTests) TestIngressRulesWithPartiallyMatchingCIDRs(c *gc.C)

func (*LiveTests) TestModelPorts

func (t *LiveTests) TestModelPorts(c *gc.C)

func (*LiveTests) TestPorts

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

func (*LiveTests) TestPrechecker

func (t *LiveTests) TestPrechecker(c *gc.C)

func (*LiveTests) TestStartInstanceWithEmptyNonceFails

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

func (*LiveTests) TestStartStop

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

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

type Tests

type Tests struct {
	TestConfig     coretesting.Attrs
	Credential     cloud.Credential
	CloudEndpoint  string
	CloudRegion    string
	ControllerUUID string
	Env            environs.Environ
	envtesting.ToolsFixture
	sstesting.TestDataSuite

	// ControllerStore holds the controller related information
	// such as controllers, accounts, etc., used when preparing
	// the environment. This is initialized by SetUpSuite.
	ControllerStore jujuclient.ClientStore

	// ProviderCallContext holds the context to be used to make
	// calls to a cloud provider.
	ProviderCallContext context.ProviderCallContext

	// BootstrapContext holds the context to bootstrap a test environment.
	BootstrapContext environs.BootstrapContext
	// contains filtered or unexported fields
}

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

func (t *Tests) AssertPrepareFailsWithConfig(c *gc.C, badConfig coretesting.Attrs, errorMatches string) error

func (*Tests) CloudSpec

func (t *Tests) CloudSpec() environscloudspec.CloudSpec

func (*Tests) Open

func (t *Tests) Open(c *gc.C, ctx stdcontext.Context, cfg *config.Config) environs.Environ

Open opens an instance of the testing environment.

func (*Tests) Prepare

func (t *Tests) Prepare(c *gc.C) environs.Environ

Prepare prepares an instance of the testing environment.

func (*Tests) PrepareParams

func (t *Tests) PrepareParams(c *gc.C) bootstrap.PrepareParams

PrepareParams returns the environs.PrepareParams that will be used to call environs.Prepare.

func (*Tests) PrepareWithParams

func (t *Tests) PrepareWithParams(c *gc.C, params bootstrap.PrepareParams) environs.Environ

PrepareWithParams prepares an instance of the testing environment.

func (*Tests) SetUpTest

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

func (*Tests) TearDownTest

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

func (*Tests) TestBootstrap

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

func (*Tests) TestStartStop

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

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