test

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package test provides common resources useful for testing many Ceph daemons. This includes functions for testing that resources match what is expected.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func VerifyAppLabels

func VerifyAppLabels(appName, namespace string, labels map[string]string) error

VerifyAppLabels returns a descriptive error if app labels are not present or not as expected.

func VerifyPodLabels

func VerifyPodLabels(appName, namespace, daemonType, daemonID string, labels map[string]string) error

VerifyPodLabels returns a descriptive error if pod labels are not present or not as expected.

Types

type ContainerTestDefinition

type ContainerTestDefinition struct {
	// Image is the name of the container image
	Image *string
	// Command is the container command
	Command []string
	// Args is a list of expected arguments in the same format as the expected arguments from
	// the ArgumentsMatchExpected() function.
	Args [][]string
	// InOrderArgs is a map of argument position (int) to the argument itself (string). If the
	// "third" arg must be exactly the third argument this should be: InOrderArgs[2]="third"
	InOrderArgs map[int]string
	// VolumeMountNames is a list of volume mount names which must be mounted in the container
	VolumeMountNames []string
	// EnvCount is the number of 'Env' variables the container should define
	EnvCount *int
	// Ports is a list of ports the container must define. This list is in order, and each port's
	// 'ContainerPort' and 'Protocol' are tested for equality.
	// Note: port's in general aren't order-dependent, but there is not yet a method to test for
	//       the existence of a port in a list of ports without caring about order.
	Ports []v1.ContainerPort
	// IsPrivileged tests if the container is privileged (true) or unprivileged (false)
	IsPrivileged *bool
}

ContainerTestDefinition defines which k8s container values to test and what those values should be. Any definition item may be nil, and a nil value will prevent the item from being tested in the container test.

func (*ContainerTestDefinition) TestContainer

func (d *ContainerTestDefinition) TestContainer(
	t *testing.T,
	moniker string,
	cont *v1.Container,
	logger *capnslog.PackageLogger,
)

TestContainer tests that a container matches the container test definition. Moniker is a name given to the container for identifying it in tests. Cont is the container to be tested. Logger is the logger to output logs to.

Jump to

Keyboard shortcuts

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