Documentation
¶
Overview ¶
Package testutil contains some methods useful to mock components while testing
Index ¶
- func BeNotFound() types.GomegaMatcher
- func FailBecauseNotFound() types.GomegaMatcher
- func FakeCSRRequest(commonName string) (csrBytes []byte, err error)
- func FakeConfigMap(namespace, name string, data map[string]string) *corev1.ConfigMap
- func FakeEventRecorder(bufferSize int) *record.FakeRecorder
- func FakePodWithSingleContainer(namespace, name, image string) *corev1.Pod
- func FakeSecret(namespace, name string, data map[string]string) *corev1.Secret
- func FakeSelfSignedCertificate(commonName string) (certificate []byte, err error)
- func FakeService(namespace, name, clusterIP, protocol string, port int32) *corev1.Service
- type Cluster
- type DnsServer
- type IsNotFoundErrorMatcher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BeNotFound ¶ added in v0.3.1
func BeNotFound() types.GomegaMatcher
BeNotFound returns a new IsNotFoundErrorMatcher to catch k8s not-found errors.
func FailBecauseNotFound ¶ added in v0.3.1
func FailBecauseNotFound() types.GomegaMatcher
FailBecauseNotFound returns a new IsNotFoundErrorMatcher to catch k8s not-found errors.
func FakeCSRRequest ¶
FakeCSRRequest returns the content of a CSR request for testing purposes.
func FakeConfigMap ¶
FakeConfigMap returns a configmap with the specified namespace, name and data.
func FakeEventRecorder ¶
func FakeEventRecorder(bufferSize int) *record.FakeRecorder
FakeEventRecorder returns an event recorder that can be used to capture events.
func FakePodWithSingleContainer ¶
FakePodWithSingleContainer returns a pod with the specified namespace and name, and having a single container with the specified image.
func FakeSecret ¶
FakeSecret returns a secret with the specified namespace, name and data.
func FakeSelfSignedCertificate ¶
FakeSelfSignedCertificate returns the content of a self-signed certificate for testing purposes.
Types ¶
type Cluster ¶
type Cluster struct {
// contains filtered or unexported fields
}
func (*Cluster) GetClient ¶
func (c *Cluster) GetClient() kubernetes.Interface
GetClient returns the crd client.
func (*Cluster) GetEnv ¶
func (c *Cluster) GetEnv() *envtest.Environment
GetEnv returns the test environment.
type IsNotFoundErrorMatcher ¶ added in v0.3.1
type IsNotFoundErrorMatcher struct{}
IsNotFoundErrorMatcher is a custom matcher to check when kubernetes resources do not exist.
func (*IsNotFoundErrorMatcher) FailureMessage ¶ added in v0.3.1
func (s *IsNotFoundErrorMatcher) FailureMessage(actual interface{}) (message string)
FailureMessage is called when the matcher fails positively.
func (*IsNotFoundErrorMatcher) Match ¶ added in v0.3.1
func (s *IsNotFoundErrorMatcher) Match(actual interface{}) (success bool, err error)
Match is a GomegaMatcher interface method to actually run the matcher.
func (*IsNotFoundErrorMatcher) NegatedFailureMessage ¶ added in v0.3.1
func (s *IsNotFoundErrorMatcher) NegatedFailureMessage(actual interface{}) (message string)
NegatedFailureMessage is called when the matcher fails negatively.