Documentation
¶
Index ¶
- Constants
- func ConvertToAuthSecret(auth client.Auth) (secret corev1.Secret)
- func FromSharedScheme(ctx context.Context) *runtime.Scheme
- func GetConfigFromContext(ctx context.Context) interface{}
- func GetPluginAddress(client *resty.Client, plugin client.Interface) (address *duckv1.Addressable, err error)
- func MustGetPluginAddress(client *resty.Client, plugin client.Interface) (address *duckv1.Addressable)
- func MustRollback(testCtx *TestContext, obj client.Object, opts ...client.DeleteOption)
- func NewConfigCondition(configName string, obj interface{}) *configCondition
- func NewTestConfigMap(name, namespace string, data map[string]string) *v1.ConfigMap
- func PluginService(ctx context.Context, clt client.Client, name string) (*corev1.Service, error)
- func RequestWrapAuthMeta(req *resty.Request, auth client.Auth, meta client.Meta) *resty.Request
- func ResourceTopConditionIsReadyEventually(ctx *TestContext, obj client.Object, readyFuncs ...IsReadyCheckFunc) func(g Gomega) error
- func ShareScheme(scheme *runtime.Scheme) base.SharedExtension
- func WaitRollback(testCtx *TestContext, obj client.Object)
- func WithSharedScheme(ctx context.Context, scheme *runtime.Scheme) context.Context
- type Condition
- type ConditionFunc
- type IsReadyCheckFunc
- type NamespaceCondition
- type Poller
- type ReconcileCondition
- type ServicePortForward
- type TestCaseBuilder
- func (b *TestCaseBuilder) Do() bool
- func (b *TestCaseBuilder) DoFunc(f TestSpecFunc) bool
- func (b *TestCaseBuilder) WithClusterScope() *TestCaseBuilder
- func (b *TestCaseBuilder) WithCondition(funcs ...Condition) *TestCaseBuilder
- func (b *TestCaseBuilder) WithFunc(tc TestSpecFunc) *TestCaseBuilder
- func (b *TestCaseBuilder) WithNamespacedScope() *TestCaseBuilder
- func (b *TestCaseBuilder) WithScheme(scheme *runtime.Scheme) *TestCaseBuilder
- func (b *TestCaseBuilder) WithTestContextOptions(options ...TestContextOption) *TestCaseBuilder
- type TestCaseScope
- type TestConfig
- type TestContext
- type TestContextOption
- type TestNamespaceCondition
- type TestSpecFunc
Constants ¶
const ( ControllerLabel base.TestCaseLabel = "controller" WebhookLabel base.TestCaseLabel = "webhook" WebServiceLabel base.TestCaseLabel = "webservice" CliLabel base.TestCaseLabel = "cli" )
Variables ¶
This section is empty.
Functions ¶
func ConvertToAuthSecret ¶
ConvertToAuthSecret convert auth
func FromSharedScheme ¶
FromSharedScheme get scheme from context
func GetConfigFromContext ¶
GetConfigFromContext get the config information from context
func GetPluginAddress ¶
func GetPluginAddress(client *resty.Client, plugin client.Interface) (address *duckv1.Addressable, err error)
GetPluginAddress get the base url of the plugin
func MustGetPluginAddress ¶
func MustGetPluginAddress(client *resty.Client, plugin client.Interface) (address *duckv1.Addressable)
MustGetPluginAddress get the base url or panics if the parse fails.
func MustRollback ¶
func MustRollback(testCtx *TestContext, obj client.Object, opts ...client.DeleteOption)
MustRollback delete an object and wait for completion
func NewConfigCondition ¶
func NewConfigCondition(configName string, obj interface{}) *configCondition
NewConfigCondition construct an configCondition object `obj` is a pointer which used to unmarshal configuration to
func NewTestConfigMap ¶
NewTestConfigMap helper function for constructing a new configmap
func PluginService ¶
PluginService Get plugin service by plugin name
func RequestWrapAuthMeta ¶
RequestWrapAuthMeta wrap auth and meta information into http request
func ResourceTopConditionIsReadyEventually ¶
func ResourceTopConditionIsReadyEventually(ctx *TestContext, obj client.Object, readyFuncs ...IsReadyCheckFunc) func(g Gomega) error
ResourceTopConditionIsReadyEventually generic function to check if a resource is ready resource type must implement GetTopLevelCondition() *apis.Condition function
func ShareScheme ¶
func ShareScheme(scheme *runtime.Scheme) base.SharedExtension
ShareScheme to construct extension to share scheme
func WaitRollback ¶
func WaitRollback(testCtx *TestContext, obj client.Object)
WaitRollback Wait for the delete object behavior to complete
Types ¶
type Condition ¶
type Condition interface {
Condition(testCtx *TestContext) error
}
func NewNamespaceCondition ¶
NewNamespaceCondition construct a namespace condition
type ConditionFunc ¶
type ConditionFunc func(testCtx *TestContext) error
ConditionFunc helper function to wrapping condition
func (ConditionFunc) Condition ¶
func (c ConditionFunc) Condition(testCtx *TestContext) error
Condition implement the Condition interface
type IsReadyCheckFunc ¶
IsReadyCheckFunc additional function to check if object is ready in an Eventually context
example: ``` func(g Gomega, obj client.Object) error { if obj.GetName() == "" { fmt.Errorf("should have a name") } // or use g.Expect instead g.Expect(obj.GetName()).To(Equal("")) return nil } ```
type NamespaceCondition ¶
type NamespaceCondition struct {
Namespace string
}
NamespaceCondition generate namespace for testing
func (*NamespaceCondition) Condition ¶
func (t *NamespaceCondition) Condition(testCtx *TestContext) error
Condition implement the Condition interface Delete the namespace when it already exists, then create a new one. After the testing is completed, delete the namespace as well.
type Poller ¶
Poller describe the configuration of Poller Interval: Indicates the inspection interval Timeout: Indicates the maximum time the check will last
type ReconcileCondition ¶
type ReconcileCondition struct { *Poller // contains filtered or unexported fields }
ReconcileCondition check if a controller is available
func NewReconcileCondition ¶
func NewReconcileCondition(obj client.Object, objCheckFun func(obj client.Object) bool) *ReconcileCondition
NewReconcileCondition helper function for constructing a `ReconcileCondition` object
func (*ReconcileCondition) Condition ¶
func (n *ReconcileCondition) Condition(testCtx *TestContext) error
Condition implement the Condition interface Apply an object and wait for reconciliation, then check the status via `objCheckFun`
func (*ReconcileCondition) WithPoller ¶
func (n *ReconcileCondition) WithPoller(interval, timeout time.Duration) *ReconcileCondition
WithPoller customize poller settings
type ServicePortForward ¶
type ServicePortForward struct { Namespace string ServiceName string ServicePortFilter func(ports []v1.ServicePort) int32 // contains filtered or unexported fields }
ServicePortForward describe the configuration of port forwarding
func NewServicePortForward ¶
func NewServicePortForward(ns string, serviceName string) *ServicePortForward
NewServicePortForward construct a new ServicePortForward object
func (*ServicePortForward) Close ¶
func (s *ServicePortForward) Close()
Close will stop the forwarder
func (*ServicePortForward) Forward ¶
func (s *ServicePortForward) Forward(testCtx *TestContext) (restyClient *resty.Client, err error)
Forward setting a forwarder
type TestCaseBuilder ¶
type TestCaseBuilder struct { // Conditions condition list which will be checked before test case execution Conditions []Condition // Scope defines what kind of permissions this test case needs Scope TestCaseScope // TestContextOptions used to setup TestContext TestContextOptions []TestContextOption // Scheme the scheme for initializing the k8s client Scheme *runtime.Scheme // contains filtered or unexported fields }
func NewTestCaseBuilder ¶
func NewTestCaseBuilder(baseBuilder base.TestCaseBuilder) *TestCaseBuilder
func (*TestCaseBuilder) DoFunc ¶
func (b *TestCaseBuilder) DoFunc(f TestSpecFunc) bool
DoFunc build and return the test case, just like the Do function
func (*TestCaseBuilder) WithClusterScope ¶
func (b *TestCaseBuilder) WithClusterScope() *TestCaseBuilder
WithClusterScope set the scope of the testcase as a cluster scoped
func (*TestCaseBuilder) WithCondition ¶
func (b *TestCaseBuilder) WithCondition(funcs ...Condition) *TestCaseBuilder
WithCondition sets conditions
func (*TestCaseBuilder) WithFunc ¶
func (b *TestCaseBuilder) WithFunc(tc TestSpecFunc) *TestCaseBuilder
WithFunc replaces the function with another given function
func (*TestCaseBuilder) WithNamespacedScope ¶
func (b *TestCaseBuilder) WithNamespacedScope() *TestCaseBuilder
WithNamespacedScope set the scope of the testcase as namespaced
func (*TestCaseBuilder) WithScheme ¶
func (b *TestCaseBuilder) WithScheme(scheme *runtime.Scheme) *TestCaseBuilder
WithScheme adds a scheme object to the framework
func (*TestCaseBuilder) WithTestContextOptions ¶
func (b *TestCaseBuilder) WithTestContextOptions(options ...TestContextOption) *TestCaseBuilder
WithTestContextOptions sets options of TestContext
type TestCaseScope ¶
type TestCaseScope string
TestCaseScope scope for test case
const ( // ClusterScoped cluster test case scope ClusterScoped TestCaseScope = "Cluster" // NamespaceScoped test case scoped for a Namespace NamespaceScoped TestCaseScope = "Namespaced" )
type TestConfig ¶
TestConfig Provide a unified way to get configuration from configmap
func NewE2EConfig ¶
func NewE2EConfig(cmName string) *TestConfig
NewE2EConfig construct a `TestConfig` with special configmap name
type TestContext ¶
type TestContext struct { base.TestContext Config *rest.Config Scheme *runtime.Scheme Client client.Client Namespace string MultiClusterClient multicluster.Interface }
TestContext context for cluster testing
type TestContextOption ¶
type TestContextOption func(*TestContext)
TestContextOption options for building TestContext
func NamespaceOption ¶
func NamespaceOption(ns string) TestContextOption
NamespaceOption customize the namespace name
func NamespacePrefixOption ¶
func NamespacePrefixOption(prefix string) TestContextOption
NamespacePrefixOption customize the prefix of the namespace name
type TestNamespaceCondition ¶
type TestNamespaceCondition struct{}
TestNamespaceCondition generate namespace for testing
func (*TestNamespaceCondition) Condition ¶
func (t *TestNamespaceCondition) Condition(testCtx *TestContext) error
Condition implement the Condition interface Delete the namespace when it already exists, then create a new one. After the testing is completed, delete the namespace as well.
type TestSpecFunc ¶
type TestSpecFunc func(*TestContext)