test

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KnDefaultTestImage string        = "gcr.io/knative-samples/helloworld-go"
	MaxRetries         int           = 10
	RetrySleepDuration time.Duration = 5 * time.Second
)

Variables

Flags holds the command line flags or defaults for settings in the user's environment. See ClientFlags for the list of supported fields.

Functions

func CreateNamespace

func CreateNamespace(namespace string) error

CreateNamespace creates and tests a namesspace creation invoking kubectl

func CurrentDir

func CurrentDir(t *testing.T) string

func DeleteNamespace

func DeleteNamespace(namespace string) error

DeleteNamespace deletes and tests a namesspace deletion invoking kubectl

func GetNextNamespaceId

func GetNextNamespaceId() int

GetNextNamespaceId return the next unique ID for the next namespace

func GetNextServiceName

func GetNextServiceName(base string) string

GetNextServiceName return the name for the next namespace

func NextNamespace

func NextNamespace() string

NextNamespace return the next unique namespace

func RunKubectl

func RunKubectl(namespace string, args ...string) (string, error)

RunKubectl runs "kubectl" in a given namespace

func WaitForNamespaceCreated

func WaitForNamespaceCreated(namespace string) error

WaitForNamespaceCreated wait until namespace is created

func WaitForNamespaceDeleted

func WaitForNamespaceDeleted(namespace string) error

WaitForNamespaceDeleted wait until namespace is deleted

Types

type ClientFlags

type ClientFlags struct {
	DockerConfigJSON string
}

ClientFlags define the flags that are needed to run the e2e tests.

func InitializeFlags

func InitializeFlags() *ClientFlags

InitializeFlags initializes the client's flags

type Kn

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

Kn type

func NewKn

func NewKn() Kn

NewKn object

func (Kn) Namespace

func (k Kn) Namespace() string

Namespace that this Kn instance uses

func (Kn) Run

func (k Kn) Run(args ...string) KnRunResult

Run the 'kn' CLI with args

func (Kn) RunNoNamespace added in v0.14.0

func (k Kn) RunNoNamespace(args ...string) KnRunResult

RunNoNamespace the 'kn' CLI with args but no namespace

type KnRunResult

type KnRunResult struct {
	// Command line called
	CmdLine string
	// Standard output of command
	Stdout string
	// Standard error of command
	Stderr string
	// And extra dump informations in case of an unexpected error
	DumpInfo string
	// Error occurred during execution
	Error error
	// Was an error expected ?
	ErrorExpected bool
}

KnRunResult holds command and result artifacts of a "kn" call

func RunKn

func RunKn(namespace string, args []string) KnRunResult

RunKn runs "kn" in a given namespace

type KnRunResultCollector

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

KnRunResultCollector collects Kn run's results

func NewKnRunResultCollector

func NewKnRunResultCollector(t *testing.T, knTest *KnTest) *KnRunResultCollector

NewKnRunResultCollector returns a new KnRunResultCollector

func (*KnRunResultCollector) AddDump

func (c *KnRunResultCollector) AddDump(kind string, name string, namespace string)

AddDump adds extra dump information to the collector which is printed out if an error occurs

func (*KnRunResultCollector) AssertError

func (c *KnRunResultCollector) AssertError(result KnRunResult)

AssertError helper to assert error on result

func (*KnRunResultCollector) AssertNoError

func (c *KnRunResultCollector) AssertNoError(result KnRunResult)

AssertNoError helper to assert no error on result

func (*KnRunResultCollector) DumpIfFailed

func (c *KnRunResultCollector) DumpIfFailed()

DumpIfFailed logs if collector failed

func (*KnRunResultCollector) KnTest added in v0.14.0

func (c *KnRunResultCollector) KnTest() *KnTest

KnTest returns the KnTest object

func (*KnRunResultCollector) T added in v0.14.0

func (c *KnRunResultCollector) T() *testing.T

T returns the *testing.T object

type KnTest

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

KnTest type

func NewKnTest

func NewKnTest() (*KnTest, error)

NewKnTest creates a new KnTest object

func (*KnTest) Kn

func (test *KnTest) Kn() Kn

Kn object used by this KnTest

func (*KnTest) Namespace

func (test *KnTest) Namespace() string

Namespace used by the test

func (*KnTest) Teardown

func (test *KnTest) Teardown() error

Teardown clean up

type Kubectl

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

Kubectl type

func NewKubectl

func NewKubectl(namespace string) Kubectl

New Kubectl object

func (Kubectl) Namespace

func (k Kubectl) Namespace() string

Namespace that this Kubectl instance uses

func (Kubectl) Run

func (k Kubectl) Run(args ...string) (string, error)

Run the 'kubectl' CLI with args

Jump to

Keyboard shortcuts

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