e2e

package
v1.1.8 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2016 License: Apache-2.0 Imports: 69 Imported by: 0

Documentation

Overview

This is a utility for prometheus pushing functionality.

Index

Constants

View Source
const NodeStartupThreshold = 4 * time.Second

NodeStartupThreshold is a rough estimate of the time allocated for a pod to start on a node.

Variables

View Source
var MaxContainerFailures = 0

Maximum container failures this test tolerates before failing.

View Source
var ServiceNodePortRange = util.PortRange{Base: 30000, Size: 2768}

This should match whatever the default/configured range is

Functions

func BadEvents added in v0.16.0

func BadEvents(events []*api.Event) int

Prints the histogram of the events and returns the number of bad events.

func CheckCadvisorHealthOnAllNodes added in v0.11.0

func CheckCadvisorHealthOnAllNodes(c *client.Client, timeout time.Duration)

func ClusterLevelLoggingWithElasticsearch added in v0.14.0

func ClusterLevelLoggingWithElasticsearch(f *Framework)

ClusterLevelLoggingWithElasticsearch is an end to end test for cluster level logging.

func ClusterLevelLoggingWithKibana added in v1.0.0

func ClusterLevelLoggingWithKibana(f *Framework)

ClusterLevelLoggingWithKibana is an end to end test that checks to see if Kibana is alive.

func CoreDump added in v1.1.0

func CoreDump(dir string)

func DeleteRC added in v0.13.0

func DeleteRC(c *client.Client, ns, name string) error

Delete a Replication Controller and all pods it spawned

func FailedContainers added in v0.18.0

func FailedContainers(pod *api.Pod) map[string]ContainerFailures

FailedContainers inspects all containers in a pod and returns failure information for containers that have failed or been restarted. A map is returned where the key is the containerID and the value is a struct containing the restart and failure information

func Failf added in v0.11.0

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

func GetKubeletPods added in v0.21.0

func GetKubeletPods(c *client.Client, node string) (*api.PodList, error)

GetKubeletPods retrieves the list of running pods on the kubelet. The pods includes necessary information (e.g., UID, name, namespace for pods/containers), but do not contain the full spec.

func HighLatencyRequests added in v0.17.0

func HighLatencyRequests(c *client.Client, threshold time.Duration) (int, error)

Prints summary metrics for request types with latency above threshold and returns number of such request types.

func LaunchNetTestPodPerNode added in v0.15.0

func LaunchNetTestPodPerNode(f *Framework, nodes *api.NodeList, name, version string) []string

func Logf added in v0.11.0

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

func NewRestartConfig added in v1.1.0

func NewRestartConfig(nodeName, daemonName string, healthzPort int, pollInterval, pollTimeout time.Duration) *restartDaemonConfig

NewRestartConfig creates a restartDaemonConfig for the given node and daemon.

func NodeSSHHosts added in v0.18.0

func NodeSSHHosts(c *client.Client) ([]string, error)

NodeSSHHosts returns SSH-able host names for all nodes. It returns an error if it can't find an external IP for every node, though it still returns all hosts that it found in that case.

func OpenWebSocketForURL added in v1.1.1

func OpenWebSocketForURL(url *url.URL, config *client.Config, protocols []string) (*websocket.Conn, error)

OpenWebSocketForURL constructs a websocket connection to the provided URL, using the client config, with the specified protocols.

func ReserveCpu added in v1.1.0

func ReserveCpu(f *Framework, id string, millicores int)

func ReserveMemory added in v1.1.0

func ReserveMemory(f *Framework, id string, gigabytes int)

func RunRC added in v0.13.0

func RunRC(config RCConfig) error

RunRC Launches (and verifies correctness) of a Replication Controller and will wait for all pods it spawns to become "Running". It's the caller's responsibility to clean up externally (i.e. use the namespace lifecycle for handling cleanup).

func SSH added in v0.17.0

func SSH(cmd, host, provider string) (string, string, int, error)

SSH synchronously SSHs to a node running on provider and runs cmd. If there is no error performing the SSH, the stdout, stderr, and exit code are returned.

func SSHVerbose added in v1.1.0

func SSHVerbose(cmd, host, provider string) (string, string, int, error)

SSHVerbose is just like SSH, but it logs the command, user, host, stdout, stderr, exit code, and error.

func ScaleRC added in v0.18.0

func ScaleRC(c *client.Client, ns, name string, size uint, wait bool) error

func ServeImageOrFail added in v0.11.0

func ServeImageOrFail(f *Framework, test string, image string)

A basic test to check the deployment of an image using a replication controller. The image serves its hostname which is checked for each replica.

func SetTestContext added in v1.1.0

func SetTestContext(t TestContextType)

func SkipIfProviderIs added in v0.21.0

func SkipIfProviderIs(unsupportedProviders ...string)

func SkipUnlessNodeCountIsAtLeast added in v0.21.0

func SkipUnlessNodeCountIsAtLeast(minNodeCount int)

func SkipUnlessProviderIs added in v0.21.0

func SkipUnlessProviderIs(supportedProviders ...string)

func Skipf added in v0.21.0

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

func StopConsuming added in v1.1.0

func StopConsuming(f *Framework, id string)

func VerifyPodStartupLatency added in v1.1.1

func VerifyPodStartupLatency(latency PodStartupLatency, podStartupThreshold time.Duration) error

Verifies whether 50, 90 and 99th percentiles of PodStartupLatency are smaller than the given threshold (returns error in the oposite case).

Types

type APICall added in v1.1.1

type APICall struct {
	Resource string        `json:"resource"`
	Verb     string        `json:"verb"`
	Latency  LatencyMetric `json:"latency"`
}

type APIResponsiveness added in v1.1.1

type APIResponsiveness struct {
	APICalls []APICall `json:"apicalls"`
}

func (APIResponsiveness) Len added in v1.1.1

func (a APIResponsiveness) Len() int

func (APIResponsiveness) Less added in v1.1.1

func (a APIResponsiveness) Less(i, j int) bool

func (APIResponsiveness) Swap added in v1.1.1

func (a APIResponsiveness) Swap(i, j int)

type CloudConfig added in v0.15.0

type CloudConfig struct {
	ProjectID         string
	Zone              string
	Cluster           string
	MasterName        string
	NodeInstanceGroup string
	NumNodes          int
	ClusterTag        string

	Provider cloudprovider.Interface
}

type ContainerFailures added in v0.18.0

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

type Framework added in v0.18.0

type Framework struct {
	BaseName string

	Namespace                *api.Namespace
	Client                   *client.Client
	NamespaceDeletionTimeout time.Duration
}

Framework supports common operations used by e2e tests; it will keep a client & a namespace for you. Eventual goal is to merge this with integration test framework.

func NewFramework added in v0.18.0

func NewFramework(baseName string) *Framework

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

func (*Framework) ReadFileViaContainer added in v1.0.2

func (f *Framework) ReadFileViaContainer(podName, containerName string, path string) (string, error)

Read a file using kubectl exec cat <path>

func (*Framework) TestContainerOutput added in v0.18.0

func (f *Framework) TestContainerOutput(scenarioName string, pod *api.Pod, containerIndex int, expectedOutput []string)

Runs the given pod and verifies that the output of exact container matches the desired output.

func (*Framework) WaitForAnEndpoint added in v0.20.0

func (f *Framework) WaitForAnEndpoint(serviceName string) error

WaitForAnEndpoint waits for at least one endpoint to become available in the service's corresponding endpoints object.

func (*Framework) WaitForPodRunning added in v0.18.0

func (f *Framework) WaitForPodRunning(podName string) error

WaitForPodRunning waits for the pod to run in the namespace.

func (*Framework) WaitForPodRunningSlow added in v1.1.1

func (f *Framework) WaitForPodRunningSlow(podName string) error

WaitForPodRunningSlow waits for the pod to run in the namespace. It has a longer timeout then WaitForPodRunning (util.slowPodStartTimeout).

func (*Framework) WriteFileViaContainer added in v1.0.2

func (f *Framework) WriteFileViaContainer(podName, containerName string, path string, contents string) error

Write a file using kubectl exec echo <contents> > <path> via specified container Because of the primitive technique we're using here, we only allow ASCII alphanumeric characters

type KubeProxyTestConfig added in v1.1.0

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

type KubeletManagedHostConfig added in v1.1.1

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

type KubeletMetric added in v0.20.0

type KubeletMetric struct {
	// eg: list, info, create
	Operation string
	// eg: sync_pods, pod_worker
	Method string
	// 0 <= quantile <=1, e.g. 0.95 is 95%tile, 0.5 is median.
	Quantile float64
	Latency  time.Duration
}

KubeletMetric stores metrics scraped from the kubelet server's /metric endpoint. TODO: Get some more structure around the metrics and this type

func HighLatencyKubeletOperations added in v0.20.0

func HighLatencyKubeletOperations(c *client.Client, threshold time.Duration, nodeName string) ([]KubeletMetric, error)

HighLatencyKubeletOperations logs and counts the high latency metrics exported by the kubelet server via /metrics.

func ParseKubeletMetrics added in v0.21.0

func ParseKubeletMetrics(metricsBlob string) ([]KubeletMetric, error)

ParseKubeletMetrics reads metrics from the kubelet server running on the given node

type KubeletMetricByLatency added in v0.20.0

type KubeletMetricByLatency []KubeletMetric

KubeletMetricByLatency implements sort.Interface for []KubeletMetric based on the latency field.

func (KubeletMetricByLatency) Len added in v0.20.0

func (a KubeletMetricByLatency) Len() int

func (KubeletMetricByLatency) Less added in v0.20.0

func (a KubeletMetricByLatency) Less(i, j int) bool

func (KubeletMetricByLatency) Swap added in v0.20.0

func (a KubeletMetricByLatency) Swap(i, j int)

type LBCTester added in v1.1.1

type LBCTester interface {
	// contains filtered or unexported methods
}

LBCTester is an interface used to test loadbalancer controllers.

type LatencyMetric added in v0.17.0

type LatencyMetric struct {
	Perc50 time.Duration `json:"Perc50"`
	Perc90 time.Duration `json:"Perc90"`
	Perc99 time.Duration `json:"Perc99"`
}

Dashboard metrics

type PodDiff added in v0.18.0

type PodDiff map[string]*podInfo

PodDiff is a map of pod name to podInfos

func Diff added in v0.18.0

func Diff(oldPods []*api.Pod, curPods []*api.Pod) PodDiff

Diff computes a PodDiff given 2 lists of pods.

func (PodDiff) Print added in v0.18.0

func (p PodDiff) Print(ignorePhases sets.String)

Print formats and prints the give PodDiff.

type PodStartupLatency added in v1.1.1

type PodStartupLatency struct {
	Latency LatencyMetric `json:"latency"`
}

type PortsByPodName added in v1.1.0

type PortsByPodName map[string][]int

type PortsByPodUID added in v1.1.0

type PortsByPodUID map[types.UID][]int

type PrivilegedPodTestConfig added in v1.1.0

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

type RCConfig added in v0.19.0

type RCConfig struct {
	Client        *client.Client
	Image         string
	Command       []string
	Name          string
	Namespace     string
	PollInterval  time.Duration
	Timeout       time.Duration
	PodStatusFile *os.File
	Replicas      int
	CpuRequest    int64 // millicores
	CpuLimit      int64 // millicores
	MemRequest    int64 // bytes
	MemLimit      int64 // bytes

	// Env vars, set the same for every pod.
	Env map[string]string

	// Extra labels added to every pod.
	Labels map[string]string

	// Ports to declare in the container (map of name to containerPort).
	Ports map[string]int

	// Pointer to a list of pods; if non-nil, will be set to a list of pods
	// created by this RC by RunRC.
	CreatedPods *[]*api.Pod

	// Maximum allowable container failures. If exceeded, RunRC returns an error.
	// Defaults to replicas*0.1 if unspecified.
	MaxContainerFailures *int
}

type ResourceConsumer added in v1.1.0

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

ResourceConsumer is a tool for testing. It helps create specified usage of CPU or memory (Warnig: memory not supported) typical use case: rc.ConsumeCPU(600) // ... check your assumption here rc.ConsumeCPU(300) // ... check your assumption here

func NewDynamicResourceConsumer added in v1.1.0

func NewDynamicResourceConsumer(name string, replicas, initCPU, initMemory int, cpuLimit, memLimit int64, framework *Framework) *ResourceConsumer

func NewStaticResourceConsumer added in v1.1.0

func NewStaticResourceConsumer(name string, replicas, initCPU, initMemory int, cpuLimit, memLimit int64, framework *Framework) *ResourceConsumer

func (*ResourceConsumer) CleanUp added in v1.1.0

func (rc *ResourceConsumer) CleanUp()

func (*ResourceConsumer) ConsumeCPU added in v1.1.0

func (rc *ResourceConsumer) ConsumeCPU(millicores int)

ConsumeCPU consumes given number of CPU

func (*ResourceConsumer) ConsumeMem added in v1.1.0

func (rc *ResourceConsumer) ConsumeMem(megabytes int)

ConsumeMem consumes given number of Mem

func (*ResourceConsumer) GetReplicas added in v1.1.0

func (rc *ResourceConsumer) GetReplicas() int

func (*ResourceConsumer) WaitForReplicas added in v1.1.0

func (rc *ResourceConsumer) WaitForReplicas(desiredReplicas int)

type State added in v0.18.0

type State struct {
	Received map[string]int
}

partially cloned from webserver.go

type TestContextType added in v0.15.0

type TestContextType struct {
	KubeConfig  string
	KubeContext string
	CertDir     string
	Host        string
	RepoRoot    string
	Provider    string
	CloudConfig CloudConfig
	KubectlPath string
	OutputDir   string

	MinStartupPods        int
	UpgradeTarget         string
	PrometheusPushGateway string
	VerifyServiceAccount  bool
	CleanStart            bool
	// contains filtered or unexported fields
}

type VolumeTestConfig added in v0.18.0

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

Configuration of one tests. The test consist of: - server pod - runs serverImage, exports ports[] - client pod - does not need any special configuration

type WebserverTest added in v0.18.0

type WebserverTest struct {
	ServiceName string
	Namespace   string
	Client      *client.Client

	TestId string
	Labels map[string]string
	// contains filtered or unexported fields
}

Simple helper class to avoid too much boilerplate in tests

func NewWebserverTest added in v0.18.0

func NewWebserverTest(client *client.Client, namespace string, serviceName string) *WebserverTest

func (*WebserverTest) BuildServiceSpec added in v0.18.0

func (t *WebserverTest) BuildServiceSpec() *api.Service

Build default config for a service (which can then be changed)

func (*WebserverTest) Cleanup added in v0.18.0

func (t *WebserverTest) Cleanup() []error

func (*WebserverTest) CreateService added in v0.18.0

func (t *WebserverTest) CreateService(service *api.Service) (*api.Service, error)

Create a service, and record it for cleanup

func (*WebserverTest) CreateWebserverRC added in v0.20.0

func (t *WebserverTest) CreateWebserverRC(replicas int) *api.ReplicationController

CreateWebserverRC creates rc-backed pods with the well-known webserver configuration and records it for cleanup.

func (*WebserverTest) DeleteService added in v0.18.0

func (t *WebserverTest) DeleteService(serviceName string) error

Delete a service, and remove it from the cleanup list

Jump to

Keyboard shortcuts

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