test

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DummyCert = &x509.Certificate{
	SerialNumber: big.NewInt(2019),
	Subject: pkix.Name{
		Organization:  []string{"Company, INC."},
		Country:       []string{"US"},
		Province:      []string{"FL"},
		Locality:      []string{"Miami"},
		StreetAddress: []string{"100 SE 2nd St"},
		PostalCode:    []string{"33131"},
	},
	NotBefore:             time.Now(),
	NotAfter:              time.Now().AddDate(10, 0, 0),
	IsCA:                  true,
	ExtKeyUsage:           []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth, x509.ExtKeyUsageServerAuth},
	KeyUsage:              x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign,
	BasicConstraintsValid: true,
}

DummyCert is a fake certificate we can use for testing

Functions

func CleanupFiles

func CleanupFiles()

CleanupFiles removes any temporary files created during tests

func ContainContext

func ContainContext(element interface{}) gotypes.GomegaMatcher

ContainContext is the Gomega matcher function

func MakeTmpFile

func MakeTmpFile() (*os.File, error)

MakeTmpFile creates a new, empty file to be used as a kubeconfig

func MockConfig

func MockConfig(num int) *kc.KConf

MockConfig generates a mock KConf with `num` number of resources

Types

type ContainContextMatcher

type ContainContextMatcher struct {
	Element interface{}
}

ContainContextMatcher gets returned by the matcher function

func (*ContainContextMatcher) FailureMessage

func (matcher *ContainContextMatcher) FailureMessage(actual interface{}) (message string)

FailureMessage displays when the context is not found but should be

func (*ContainContextMatcher) Match

func (matcher *ContainContextMatcher) Match(actual interface{}) (bool, error)

Match looks in a kubeconfig for a matching Context

func (*ContainContextMatcher) NegatedFailureMessage

func (matcher *ContainContextMatcher) NegatedFailureMessage(actual interface{}) (message string)

NegatedFailureMessage displays when the context is found but shouldn't be

Jump to

Keyboard shortcuts

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