tester

package
v1.0.0-alpha.4 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Tester

type Tester struct {

	// TestContext is a porter context for the filesystem.
	TestContext *context.TestContext

	// TestDir is the temp directory created for the test.
	TestDir string

	// PorterHomeDir is the temp PORTER_HOME directory for the test.
	PorterHomeDir string

	// RepoRoot is the root of the porter repository.
	// Useful for constructing paths that won't break when the test is moved.
	RepoRoot string

	// T is the test helper.
	T *testing.T
	// contains filtered or unexported fields
}

func NewTest

func NewTest(t *testing.T) (Tester, error)

NewTest sets up for a smoke test.

Always defer Tester.Teardown(), even when an error is returned.

func (Tester) Chdir

func (t Tester) Chdir(dir string)

func (Tester) CurrentNamespace

func (t Tester) CurrentNamespace() string

CurrentNamespace configured in config.toml

func (Tester) EditYaml

func (t Tester) EditYaml(path string, transformations ...func(yq *yaml.Editor) error)

EditYaml applies a set of yq transformations to a file.

func (Tester) ListInstallations

func (t Tester) ListInstallations(allNamespaces bool, namespace string, name string, labels []string) ([]claims.Installation, error)

func (Tester) MakeTestBundle

func (t Tester) MakeTestBundle(name string, ref string)

func (Tester) PrepareTestBundle

func (t Tester) PrepareTestBundle()

PrepareTestBundle ensures that the mybuns test bundle has been built.

func (*Tester) RequireFileMode

func (t *Tester) RequireFileMode(path string, mode os.FileMode)

RequireFileMode checks that all files in the specified path match the specifed file mode. Uses a glob pattern to match.

func (Tester) RequireInstallationExists

func (t Tester) RequireInstallationExists(namespace string, name string) claims.Installation

func (Tester) RequireInstallationInList

func (t Tester) RequireInstallationInList(namespace, name string, list []claims.Installation) claims.Installation

func (Tester) RequireInstallationNotFound

func (t Tester) RequireInstallationNotFound(namespace string, name string)

func (Tester) RequireNotFoundReturned

func (t Tester) RequireNotFoundReturned(err error)

func (Tester) RequirePorter

func (t Tester) RequirePorter(args ...string) (string, string)

Run a porter command and fail the test if the command returns an error.

func (Tester) RunPorter

func (t Tester) RunPorter(args ...string) (stdout string, combinedoutput string, err error)

Run a porter command returning stderr when it fails

func (Tester) ShowInstallation

func (t Tester) ShowInstallation(namespace string, name string) (claims.Installation, error)

func (Tester) Teardown

func (t Tester) Teardown()

Jump to

Keyboard shortcuts

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