kubetest

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2020 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateNamespace

func CreateNamespace(client kubernetes.Interface, name string) error

func DeleteNamespace

func DeleteNamespace(client kubernetes.Interface, name string) error

func PodsAreReady

func PodsAreReady(client kubernetes.Interface, replicas int, labels string) func(*ScenarioContext) error

PodsAreReady waits for a number if replicas matching the given labels to be ready. Returns a func directly (not Setup or Conditions) as it can be used in Given and When steps

func ServiceIsReady

func ServiceIsReady(client kubernetes.Interface, service string) func(*ScenarioContext) error

ServiceIsReady waits for given service to exist and have at least 1 endpoint. Returns a func directly (not Setup or Conditions) as it can be used in Given and When steps

Types

type Check

type Check func(ctx *ScenarioContext) error

func Checks

func Checks(cs ...Check) Check

func RunFails

func RunFails(client kubernetes.Interface, image string, name string, command []string, opts *RunOptions) Check

func RunSucceeds

func RunSucceeds(client kubernetes.Interface, image string, name string, command []string, opts *RunOptions) Check

type Condition

type Condition func(ctx *ScenarioContext) error

func Conditions

func Conditions(cs ...Condition) Condition

func Sleep

func Sleep(d time.Duration) Condition

type Finalizer

type Finalizer func() error

type RunOptions

type RunOptions struct {
	ServiceAccount string
	TokenAudience  string
}

type RunOpts

type RunOpts func(ctx *ScenarioContext) *ScenarioContext

func RandomNamespace

func RandomNamespace(client kubernetes.Interface) RunOpts

func Timeout

func Timeout(d time.Duration) RunOpts

type Scenario

type Scenario struct {
	KubeClient kubernetes.Interface

	Name        string
	Description string

	Given Setup
	When  Condition
	Then  Check
}

func (Scenario) Run

func (s Scenario) Run(t *testing.T, opts ...RunOpts) bool

type ScenarioContext

type ScenarioContext struct {
	Namespace string
	Finalizer []Finalizer
}

func (*ScenarioContext) AddFinalizer

func (ctx *ScenarioContext) AddFinalizer(f Finalizer)

type Setup

type Setup func(ctx *ScenarioContext) error

func CreatedManifests

func CreatedManifests(client kubernetes.Interface, paths ...string) Setup

func Setups

func Setups(ss ...Setup) Setup

type Suite

type Suite struct {
	KubeClient kubernetes.Interface
}

func NewSuiteFromKubeconfig

func NewSuiteFromKubeconfig(path string) (*Suite, error)

type TestSuite

type TestSuite func(t *testing.T)

Jump to

Keyboard shortcuts

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