test

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2020 License: Apache-2.0 Imports: 32 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// Interval specifies the time between two polls.
	Interval = 10 * time.Second
	// Timeout specifies the timeout for the function PollImmediate to reach a certain status.
	Timeout                   = 5 * time.Minute
	OperatorsNamespace        = "openshift-serverless"
	OLMNamespace              = "openshift-marketplace"
	ServerlessOperatorPackage = "serverless-operator"
)

Variables

View Source
var Flags = initializeFlags()

Flags holds the initialized test flags

Functions

func CheckDeploymentScale added in v1.7.2

func CheckDeploymentScale(ctx *Context, ns, name string, scale int) error

func CleanupAll

func CleanupAll(t *testing.T, contexts ...*Context)

Cleanup for all contexts

func CleanupOnInterrupt

func CleanupOnInterrupt(t *testing.T, cleanup func())

CleanupOnInterrupt will execute the function cleanup if an interrupt signal is caught

func CreateDeployment

func CreateDeployment(ctx *Context, name, namespace, image string) error

func CreateService

func CreateService(ctx *Context, name, namespace, image string) (*servingv1.Service, error)

func CreateSubscription

func CreateSubscription(ctx *Context, name string) (*v1alpha1.Subscription, error)

func IsCSVSucceeded

func IsCSVSucceeded(c *v1alpha1.ClusterServiceVersion, err error) (bool, error)

func IsServiceReady

func IsServiceReady(s *servingv1.Service, err error) (bool, error)

func IsSubscriptionInstalledCSVPresent

func IsSubscriptionInstalledCSVPresent(s *v1alpha1.Subscription, err error) (bool, error)

func Main

func Main(m *testing.M)

Main is a main test runner

func Service

func Service(name, namespace, image string, annotations map[string]string) *servingv1.Service

func Subscription

func Subscription(subscriptionName string) *v1alpha1.Subscription

func UpdateGlobalProxy added in v1.7.2

func UpdateGlobalProxy(ctx *Context, value string) error

func WaitForClusterServiceVersionState

func WaitForClusterServiceVersionState(ctx *Context, name, namespace string, inState func(s *v1alpha1.ClusterServiceVersion, err error) (bool, error)) (*v1alpha1.ClusterServiceVersion, error)

func WaitForControllerEnvironment added in v1.7.2

func WaitForControllerEnvironment(ctx *Context, ns, envName, envValue string) error

func WaitForOperatorDepsDeleted

func WaitForOperatorDepsDeleted(ctx *Context) error

func WaitForRouteState

func WaitForRouteState(ctx *Context, name, namespace string, inState func(s *routev1.Route, err error) (bool, error)) (*routev1.Route, error)

func WaitForServiceState

func WaitForServiceState(ctx *Context, name, namespace string, inState func(s *servingv1.Service, err error) (bool, error)) (*servingv1.Service, error)

func WaitForSubscriptionState

func WaitForSubscriptionState(ctx *Context, name, namespace string, inState func(s *v1alpha1.Subscription, err error) (bool, error)) (*v1alpha1.Subscription, error)

func WithDeploymentGone added in v1.7.2

func WithDeploymentGone(ctx *Context, name string, namespace string) error

func WithDeploymentReady added in v1.7.2

func WithDeploymentReady(ctx *Context, name string, namespace string) (*appsv1.Deployment, error)

func WithOperatorReady

func WithOperatorReady(ctx *Context, subscriptionName string) (*v1alpha1.Subscription, error)

func WithServiceReady

func WithServiceReady(ctx *Context, name, namespace, image string) (*servingv1.Service, error)

Types

type CleanupFunc

type CleanupFunc func() error

CleanupFunc defines a function that is called when the respective resource should be deleted. When creating resources the user should also create a CleanupFunc and register with the Context

type Clients

Clients holds instances of interfaces for making requests to various APIs

func NewClients

func NewClients(kubeconfig string) (*Clients, error)

NewClients instantiates and returns several clientsets required for making request to the Knative cluster

type Context

type Context struct {
	Name        string
	T           *testing.T
	Clients     *Clients
	CleanupList []CleanupFunc
}

Context holds objects related to test execution

func SetupClusterAdmin

func SetupClusterAdmin(t *testing.T) *Context

SetupClusterAdmin returns context for Cluster Admin user

func SetupEdit

func SetupEdit(t *testing.T) *Context

SetupEdit returns context for user with Edit role

func SetupProjectAdmin

func SetupProjectAdmin(t *testing.T) *Context

SetupProjectAdmin returns context for Project Admin user

func SetupView

func SetupView(t *testing.T) *Context

SetupView returns context for user with View role

func (*Context) AddToCleanup

func (ctx *Context) AddToCleanup(f CleanupFunc)

AddToCleanup adds the cleanup function as the first function to the cleanup list, we want to delete the last thing first

func (*Context) Cleanup

func (ctx *Context) Cleanup(t *testing.T)

Cleanup iterates through the list of registered CleanupFunc functions and calls them

type FlagsStruct

type FlagsStruct struct {
	Kubeconfigs   string // Path to .kube/config
	CatalogSource string // CatalogSource in the openshift-marketplace namespace for the serverless-operator Subscription
	Channel       string // serverless-operator Subscription channel
}

FlagsStruct is struct that defines testing options

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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