framework

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2018 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultUIDPrefix is a default UID prefix of PodSandbox
	DefaultUIDPrefix string = "cri-test-uid"

	// DefaultNamespacePrefix is a default namespace prefix of PodSandbox
	DefaultNamespacePrefix string = "cri-test-namespace"

	// DefaultAttempt is a default attempt prefix of PodSandbox or container
	DefaultAttempt uint32 = 2

	// DefaultContainerImage is the default image for container using
	DefaultContainerImage string = "busybox:1.28"

	// DefaultStopContainerTimeout is the default timeout for stopping container
	DefaultStopContainerTimeout int64 = 60
)

Variables

This section is empty.

Functions

func BuildContainerMetadata

func BuildContainerMetadata(containerName string, attempt uint32) *runtimeapi.ContainerMetadata

BuildContainerMetadata builds containerMetadata.

func BuildPodSandboxMetadata

func BuildPodSandboxMetadata(podSandboxName, uid, namespace string, attempt uint32) *runtimeapi.PodSandboxMetadata

BuildPodSandboxMetadata builds PodSandboxMetadata.

func CreateContainer

CreateContainer creates a container with the prefix of containerName.

func CreateContainerWithError

CreateContainerWithError creates a container but leave error check to caller

func CreateDefaultContainer

func CreateDefaultContainer(rc internalapi.RuntimeService, ic internalapi.ImageManagerService, podID string, podConfig *runtimeapi.PodSandboxConfig, prefix string) string

CreateDefaultContainer creates a default container with default options.

func CreatePodSandboxForContainer

func CreatePodSandboxForContainer(c internalapi.RuntimeService) (string, *runtimeapi.PodSandboxConfig)

CreatePodSandboxForContainer creates a PodSandbox for creating containers.

func ExpectNoError

func ExpectNoError(err error, explain ...interface{})

ExpectNoError reports error if err is not nil.

func Failf

func Failf(format string, args ...interface{})

Failf prints an error message.

func ImageStatus

func ImageStatus(c internalapi.ImageManagerService, imageName string) *runtimeapi.Image

ImageStatus gets the status of the image named imageName.

func KubeDescribe

func KubeDescribe(text string, body func()) bool

KubeDescribe is a wrapper on Describe.

func ListImage

ListImage list the image filtered by the image filter.

func Logf

func Logf(format string, args ...interface{})

Logf prints a info message.

func NewUUID

func NewUUID() string

NewUUID creates a new UUID string.

func PullPublicImage

func PullPublicImage(c internalapi.ImageManagerService, imageName string) string

PullPublicImage pulls the public image named imageName.

func RegisterFlags

func RegisterFlags()

RegisterFlags registers flags to e2e test suites.

func RunDefaultPodSandbox

func RunDefaultPodSandbox(c internalapi.RuntimeService, prefix string) string

RunDefaultPodSandbox runs a PodSandbox with default options.

func RunPodSandbox

RunPodSandbox runs a PodSandbox.

Types

type Framework

type Framework struct {
	// CRI client
	CRIClient *InternalAPIClient
}

Framework will keep a client for you.

func NewCRIFramework

func NewCRIFramework(client *InternalAPIClient) *Framework

NewCRIFramework creates a new Framework.

func NewDefaultCRIFramework

func NewDefaultCRIFramework() *Framework

NewDefaultCRIFramework makes a new framework and sets up a BeforeEach/AfterEach for you (you can write additional before/after each functions).

func (*Framework) AfterEach

func (f *Framework) AfterEach()

AfterEach clean resources

func (*Framework) BeforeEach

func (f *Framework) BeforeEach()

BeforeEach gets a client

type InternalAPIClient

type InternalAPIClient struct {
	CRIRuntimeClient internalapi.RuntimeService
	CRIImageClient   internalapi.ImageManagerService
}

InternalAPIClient is the CRI client.

func LoadCRIClient

func LoadCRIClient() (*InternalAPIClient, error)

LoadCRIClient creates a InternalAPIClient.

type TestContextType

type TestContextType struct {
	// Report related settings.
	ReportDir    string
	ReportPrefix string

	// CRI client configurations.
	ImageServiceAddr      string
	ImageServiceTimeout   time.Duration
	RuntimeServiceAddr    string
	RuntimeServiceTimeout time.Duration
	RuntimeHandler        string

	// Benchmark setting.
	Number int
}

TestContextType is the type of test context.

var TestContext TestContextType

TestContext is a test context.

Jump to

Keyboard shortcuts

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