testing

package
v1.12.0-alpha.0 Latest Latest
Warning

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

Go to latest
Published: May 17, 2018 License: Apache-2.0, Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAttribute

func NewAttribute(namespace string) admission.Attributes

NewAttribute returns static admission Attributes for testing.

func NewAuthenticationInfoResolver

func NewAuthenticationInfoResolver(cacheMisses *int32) config.AuthenticationInfoResolver

NewAuthenticationInfoResolver creates a fake AuthenticationInfoResolver that counts cache misses on every call to its methods.

func NewFakeDataSource

func NewFakeDataSource(name string, webhooks []registrationv1beta1.Webhook, mutating bool, stopCh <-chan struct{}) (clientset kubernetes.Interface, factory informers.SharedInformerFactory)

NewFakeDataSource returns a mock client and informer returning the given webhooks.

func NewServiceResolver

func NewServiceResolver(base url.URL) config.ServiceResolver

NewServiceResolver returns a static service resolve that return the given URL or an error for the failResolve namespace.

func NewTestServer

func NewTestServer(t *testing.T) *httptest.Server

NewTestServer returns a webhook test HTTPS server with fixed webhook test certs.

func Wrapper

Wrapper turns an AuthenticationInfoResolver into a AuthenticationInfoResolverWrapper that unconditionally returns the given AuthenticationInfoResolver.

Types

type CachedTest

type CachedTest struct {
	Name            string
	Webhooks        []registrationv1beta1.Webhook
	ExpectAllow     bool
	ExpectCacheMiss bool
}

CachedTest is a test case for the client manager.

func NewCachedClientTestcases

func NewCachedClientTestcases(url *url.URL) []CachedTest

NewCachedClientTestcases returns a set of client manager test cases.

type Test

type Test struct {
	Name          string
	Webhooks      []registrationv1beta1.Webhook
	Path          string
	ExpectAllow   bool
	ErrorContains string
}

Test is a webhook test case.

func NewTestCases

func NewTestCases(url *url.URL) []Test

NewTestCases returns test cases with a given base url.

Jump to

Keyboard shortcuts

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