framework

package
v1.6.112 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2023 License: MPL-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Deprecated: no longer use e2e/framework for new tests; see TestExample for new e2e test structure.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddSuites deprecated

func AddSuites(s ...*TestSuite)

AddSuites adds a set of test suites to the package scoped Framework

Deprecated: no longer use e2e/framework for new tests; see TestExample for new e2e test structure.

func Run deprecated

func Run(t *testing.T)

Run starts the package scoped Framework, running each TestSuite

Deprecated: no longer use e2e/framework for new tests; see TestExample for new e2e test structure.

Types

type AfterAllTests deprecated

type AfterAllTests interface {
	AfterAll(*F)
}

AfterAllTests is used to define a method to be called after the execution of all tests.

Deprecated: no longer use e2e/framework for new tests; see TestExample for new e2e test structure.

type AfterEachTest deprecated

type AfterEachTest interface {
	AfterEach(*F)
}

AfterEachTest is used to define a method to be called after each test.

Deprecated: no longer use e2e/framework for new tests; see TestExample for new e2e test structure.

type BeforeAllTests deprecated

type BeforeAllTests interface {
	BeforeAll(*F)
}

BeforeAllTests is used to define a method to be called before the execution of all tests.

Deprecated: no longer use e2e/framework for new tests; see TestExample for new e2e test structure.

type BeforeEachTest deprecated

type BeforeEachTest interface {
	BeforeEach(*F)
}

BeforeEachTest is used to define a method to be called before each test.

Deprecated: no longer use e2e/framework for new tests; see TestExample for new e2e test structure.

type ClusterInfo deprecated

type ClusterInfo struct {
	ID           string
	Name         string
	NomadClient  *napi.Client
	ConsulClient *capi.Client
	VaultClient  *vapi.Client
}

ClusterInfo is a handle to a provisioned cluster, along with clients a test run can use to connect to the cluster.

Deprecated: no longer use e2e/framework for new tests; see TestExample for new e2e test structure.

type Constraints deprecated

type Constraints struct {
	Provider    string   // Cloud provider ex. 'aws', 'azure', 'gcp'
	OS          string   // Operating system ex. 'windows', 'linux'
	Arch        string   // CPU architecture ex. 'amd64', 'arm64'
	Environment string   // Environment name ex. 'simple'
	Tags        []string // Generic tags that must all exist in the environment
}

Constraints that must be satisfied for a TestSuite to run

Deprecated: no longer use e2e/framework for new tests; see TestExample for new e2e test structure.

type Environment deprecated

type Environment struct {
	Name     string
	Provider string
	OS       string
	Arch     string
	Tags     map[string]struct{}
}

Environment contains information about the test target environment, used to constrain the set of tests run. See the environment flags above.

Deprecated: no longer use e2e/framework for new tests; see TestExample for new e2e test structure.

type F deprecated

type F struct {
	*require.Assertions
	// contains filtered or unexported fields
}

F is the framework context that is passed to each test. It is used to access the *testing.T context as well as testify helpers

Deprecated: no longer use e2e/framework for new tests; see TestExample for new e2e test structure.

func (*F) Assert deprecated

func (f *F) Assert() *assert.Assertions

Assert fetches an assert flavor of testify assertions https://godoc.org/github.com/stretchr/testify/assert

Deprecated: no longer use e2e/framework for new tests; see TestExample for new e2e test structure.

func (*F) ID

func (f *F) ID() string

ID returns the current context ID

func (*F) Set

func (f *F) Set(key, val interface{})

Set is used to set arbitrary key/values to pass between before/after and test methods

func (*F) T

func (f *F) T() *testing.T

T returns the *testing.T context

func (*F) Value

func (f *F) Value(key interface{}) interface{}

Value retrives values set by the F.Set method

type Framework deprecated

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

Deprecated: no longer use e2e/framework for new tests; see TestExample for new e2e test structure.

func New deprecated

func New() *Framework

New creates a Framework

Deprecated: no longer use e2e/framework for new tests; see TestExample for new e2e test structure.

func (*Framework) AddSuites deprecated

func (f *Framework) AddSuites(s ...*TestSuite) *Framework

AddSuites adds a set of test suites to a Framework

Deprecated: no longer use e2e/framework for new tests; see TestExample for new e2e test structure.

func (*Framework) Run

func (f *Framework) Run(t *testing.T)

Run starts the test framework, running each TestSuite

type Provisioner deprecated

type Provisioner interface {
	// SetupTestRun is called at the start of the entire test run.
	SetupTestRun(t *testing.T, opts SetupOptions) (*ClusterInfo, error)

	// SetupTestSuite is called at the start of each TestSuite.
	// TODO: no current provisioner implementation uses this, but we
	// could use it to provide each TestSuite with an entirely separate
	// Nomad cluster.
	SetupTestSuite(t *testing.T, opts SetupOptions) (*ClusterInfo, error)

	// SetupTestCase is called at the start of each TestCase in every TestSuite.
	SetupTestCase(t *testing.T, opts SetupOptions) (*ClusterInfo, error)

	// TearDownTestCase is called after each TestCase in every TestSuite.
	TearDownTestCase(t *testing.T, clusterID string) error

	// TearDownTestSuite is called after every TestSuite.
	TearDownTestSuite(t *testing.T, clusterID string) error

	// TearDownTestRun is called at the end of the entire test run.
	TearDownTestRun(t *testing.T, clusterID string) error
}

Provisioner interface is used by the test framework to provision API clients for a Nomad cluster, with the possibility of extending to provision standalone clusters for each test case in the future.

The Setup* methods are hooks that get run at the appropriate stage. They return a ClusterInfo handle that helps TestCases isolate test state if they use the ClusterInfo.ID as part of job IDs.

The TearDown* methods are hooks to clean up provisioned cluster state that isn't covered by the test case's implementation of AfterEachTest.

Deprecated: no longer use e2e/framework for new tests; see TestExample for new e2e test structure.

var DefaultProvisioner Provisioner = new(singleClusterProvisioner)

DefaultProvisioner is a Provisioner that doesn't deploy a Nomad cluster (because that's handled by Terraform elsewhere), but build clients from environment variables.

Deprecated: no longer use e2e/framework for new tests; see TestExample for new e2e test structure.

type SetupOptions deprecated added in v1.6.105

type SetupOptions struct {
	Name         string
	ExpectConsul bool // If true, fails if a Consul client can't be configured
	ExpectVault  bool // If true, fails if a Vault client can't be configured
}

SetupOptions defines options to be given to the Provisioner when calling Setup* methods.

Deprecated: no longer use e2e/framework for new tests; see TestExample for new e2e test structure.

type TC deprecated

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

TC is the base test case which should be embedded in TestCase implementations.

Deprecated: no longer use e2e/framework for new tests; see TestExample for new e2e test structure.

func (*TC) Consul

func (tc *TC) Consul() *capi.Client

Consul returns a configured consul api client

func (*TC) Name

func (tc *TC) Name() string

Name returns the name of the test case which is set to the name of the implementing type.

func (*TC) Nomad

func (tc *TC) Nomad() *api.Client

Nomad returns a configured nomad api client

type TestCase deprecated

type TestCase interface {
	Name() string
	// contains filtered or unexported methods
}

TestCase is the interface which an E2E test case implements. It is not meant to be implemented directly, instead the struct should embed the 'framework.TC' struct

Deprecated: no longer use e2e/framework for new tests; see TestExample for new e2e test structure.

type TestSuite deprecated

type TestSuite struct {
	Component string // Name of the component/system/feature tested

	CanRunLocal bool        // Flags if the cases are safe to run on a local nomad cluster
	Cases       []TestCase  // Cases to run
	Constraints Constraints // Environment constraints to follow
	Parallel    bool        // If true, will run test cases in parallel
	Slow        bool        // Slow test suites don't run by default

	// API Clients
	Consul bool
	Vault  bool
}

TestSuite defines a set of test cases and under what conditions to run them

Deprecated: no longer use e2e/framework for new tests; see TestExample for new e2e test structure.

Jump to

Keyboard shortcuts

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