Documentation ¶
Overview ¶
Package framework is a package helping setting up end-to-end testing across a Kubernetes cluster.
Index ¶
- Constants
- func FleetReadyCount(amount int32) func(fleet *agonesv1.Fleet) bool
- func GetAllocation(f *agonesv1.Fleet) *allocationv1.GameServerAllocation
- func SendGameServerUDP(gs *agonesv1.GameServer, msg string) (string, error)
- func SendUDP(address, msg string) (string, error)
- type Framework
- func (f *Framework) AssertFleetCondition(t *testing.T, flt *agonesv1.Fleet, condition func(fleet *agonesv1.Fleet) bool)
- func (f *Framework) CleanUp(ns string) error
- func (f *Framework) CreateAndApplyAllocation(t *testing.T, flt *agonesv1.Fleet) *allocationv1.GameServerAllocation
- func (f *Framework) CreateGameServerAndWaitUntilReady(ns string, gs *agonesv1.GameServer) (*agonesv1.GameServer, error)
- func (f *Framework) CreateNamespace(t *testing.T, namespace string)
- func (f *Framework) DefaultGameServer(namespace string) *agonesv1.GameServer
- func (f *Framework) DeleteNamespace(t *testing.T, namespace string)
- func (f *Framework) ListGameServersFromFleet(flt *agonesv1.Fleet) ([]agonesv1.GameServer, error)
- func (f *Framework) NewStatsCollector(name string) *StatsCollector
- func (f *Framework) WaitForFleetAutoScalerCondition(t *testing.T, fas *autoscaling.FleetAutoscaler, ...)
- func (f *Framework) WaitForFleetCondition(t *testing.T, flt *agonesv1.Fleet, condition func(fleet *agonesv1.Fleet) bool) error
- func (f *Framework) WaitForFleetGameServerListCondition(flt *agonesv1.Fleet, cond func(servers []agonesv1.GameServer) bool) error
- func (f *Framework) WaitForFleetGameServersCondition(flt *agonesv1.Fleet, cond func(server *agonesv1.GameServer) bool) error
- func (f *Framework) WaitForGameServerState(gs *agonesv1.GameServer, state agonesv1.GameServerState, timeout time.Duration) (*agonesv1.GameServer, error)
- type StatsCollector
Constants ¶
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
FleetReadyCount returns the ready count in a fleet
func GetAllocation ¶ added in v0.12.0
func GetAllocation(f *agonesv1.Fleet) *allocationv1.GameServerAllocation
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, returns error if no Ports were allocated
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 ¶
New setups a testing framework using a kubeconfig path and the game server image to use for testing.
func NewFromFlags ¶ added in v1.4.0
NewFromFlags sets up the testing framework with the standard command line flags.
func (*Framework) AssertFleetCondition ¶ added in v1.1.0
func (f *Framework) AssertFleetCondition(t *testing.T, flt *agonesv1.Fleet, condition func(fleet *agonesv1.Fleet) bool)
AssertFleetCondition waits for the Fleet to be in a specific condition or fails the test if the condition can't be met in 5 minutes.
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) CreateNamespace ¶ added in v1.1.0
CreateNamespace creates a namespace in the test cluster
func (*Framework) DefaultGameServer ¶ added in v1.4.0
func (f *Framework) DefaultGameServer(namespace string) *agonesv1.GameServer
DefaultGameServer provides a default GameServer fixture, based on parameters passed to the Test Framework.
func (*Framework) DeleteNamespace ¶ added in v1.1.0
DeleteNamespace deletes a namespace from the test cluster
func (*Framework) ListGameServersFromFleet ¶ added in v0.5.0
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) error
WaitForFleetCondition waits for the Fleet to be in a specific condition or returns an error if the condition can't be met in 5 minutes.
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.