framework

package
v0.12.0-rc Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2019 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Overview

Package framework is a package helping setting up end-to-end testing across a Kubernetes cluster.

Index

Constants

View Source
const (
	AutoCleanupLabelKey   = "agones.dev/e2e-test-auto-cleanup"
	AutoCleanupLabelValue = "true"
)

special labels that can be put on pods to trigger automatic cleanup.

Variables

This section is empty.

Functions

func FleetReadyCount added in v0.5.0

func FleetReadyCount(amount int32) func(fleet *agonesv1.Fleet) bool

FleetReadyCount returns the ready count in a fleet

func GetAllocation added in v0.12.0

GetAllocation returns a GameServerAllocation that is looking for a Ready GameServer from this fleet.

func SendGameServerUDP added in v0.9.0

func SendGameServerUDP(gs *agonesv1.GameServer, msg string) (string, error)

SendGameServerUDP sends a message to a gameserver and returns its reply assumes the first port is the port to send the message to

func SendUDP added in v0.9.0

func SendUDP(address, msg string) (string, error)

SendUDP sends a message to an address, and returns its reply if it returns one in 30 seconds

Types

type Framework

type Framework struct {
	KubeClient      kubernetes.Interface
	AgonesClient    versioned.Interface
	GameServerImage string
	PullSecret      string
	StressTestLevel int
	PerfOutputDir   string
}

Framework is a testing framework

func New

func New(kubeconfig string) (*Framework, error)

New setups a testing framework using a kubeconfig path and the game server image to use for testing.

func (*Framework) CleanUp

func (f *Framework) CleanUp(ns string) error

CleanUp Delete all Agones resources in a given namespace.

func (*Framework) CreateAndApplyAllocation added in v0.12.0

func (f *Framework) CreateAndApplyAllocation(t *testing.T, flt *agonesv1.Fleet) *allocationv1.GameServerAllocation

CreateAndApplyAllocation creates and applies an Allocation to a Fleet

func (*Framework) CreateGameServerAndWaitUntilReady

func (f *Framework) CreateGameServerAndWaitUntilReady(ns string, gs *agonesv1.GameServer) (*agonesv1.GameServer, error)

CreateGameServerAndWaitUntilReady Creates a GameServer and wait for its state to become ready.

func (*Framework) ListGameServersFromFleet added in v0.5.0

func (f *Framework) ListGameServersFromFleet(flt *agonesv1.Fleet) ([]agonesv1.GameServer, error)

ListGameServersFromFleet lists GameServers from a particular fleet

func (*Framework) NewStatsCollector added in v0.9.0

func (f *Framework) NewStatsCollector(name string) *StatsCollector

NewStatsCollector returns new instance of statistics collector, which can be used to emit performance statistics for load tests and stress tests.

func (*Framework) WaitForFleetAutoScalerCondition added in v0.10.0

func (f *Framework) WaitForFleetAutoScalerCondition(t *testing.T, fas *autoscaling.FleetAutoscaler, condition func(fas *autoscaling.FleetAutoscaler) bool)

WaitForFleetAutoScalerCondition waits for the FleetAutoscaler to be in a specific condition or fails the test if the condition can't be met in 2 minutes. nolint: dupl

func (*Framework) WaitForFleetCondition added in v0.5.0

func (f *Framework) WaitForFleetCondition(t *testing.T, flt *agonesv1.Fleet, condition func(fleet *agonesv1.Fleet) bool)

WaitForFleetCondition waits for the Fleet to be in a specific condition or fails the test if the condition can't be met in 5 minutes. nolint: dupl

func (*Framework) WaitForFleetGameServerListCondition added in v0.9.0

func (f *Framework) WaitForFleetGameServerListCondition(flt *agonesv1.Fleet,
	cond func(servers []agonesv1.GameServer) bool) error

WaitForFleetGameServerListCondition waits for the list of GameServers to match a condition specified by a callback and the size of GameServers to match fleet's Spec.Replicas.

func (*Framework) WaitForFleetGameServersCondition added in v0.5.0

func (f *Framework) WaitForFleetGameServersCondition(flt *agonesv1.Fleet,
	cond func(server agonesv1.GameServer) bool) error

WaitForFleetGameServersCondition waits for all GameServers for a given fleet to match a condition specified by a callback.

func (*Framework) WaitForGameServerState

func (f *Framework) WaitForGameServerState(gs *agonesv1.GameServer, state agonesv1.GameServerState,
	timeout time.Duration) (*agonesv1.GameServer, error)

WaitForGameServerState Waits untils the gameserver reach a given state before the timeout expires

type StatsCollector added in v0.9.0

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

StatsCollector collects latency and throughput counters. The ReportDuration() method is safe for concurrent use by multiple goroutines.

func (*StatsCollector) Report added in v0.9.0

func (p *StatsCollector) Report()

Report outputs performance report to log.

func (*StatsCollector) ReportDuration added in v0.9.0

func (p *StatsCollector) ReportDuration(d time.Duration, err error)

ReportDuration adds a single time measurement.

Jump to

Keyboard shortcuts

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