Documentation ¶
Overview ¶
Package validators defines a FakeValidator that can be used in tests
Index ¶
- Constants
- type FakeValidator
- func (v *FakeValidator) ErrIfInvalidKey(k string) error
- func (v *FakeValidator) IsEnvVarName(k string) error
- func (v *FakeValidator) MakeAnnotationNameValidator() func([]string) error
- func (v *FakeValidator) MakeAnnotationValidator() func(map[string]string) error
- func (v *FakeValidator) MakeLabelNameValidator() func([]string) error
- func (v *FakeValidator) MakeLabelValidator() func(map[string]string) error
- func (v *FakeValidator) ValidateNamespace(s string) []string
- func (v *FakeValidator) Validator(_ map[string]string) error
- func (v *FakeValidator) ValidatorArray(_ []string) error
- func (v *FakeValidator) VerifyCall()
- func (v *FakeValidator) VerifyNoCall()
Constants ¶
const SAD = "i'm not happy Bob, NOT HAPPY"
SAD is an error string.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FakeValidator ¶
type FakeValidator struct {
// contains filtered or unexported fields
}
FakeValidator can be used in tests.
func MakeFakeValidator ¶
func MakeFakeValidator() *FakeValidator
MakeFakeValidator makes an empty Fake Validator.
func MakeHappyMapValidator ¶
func MakeHappyMapValidator(t *testing.T) *FakeValidator
MakeHappyMapValidator makes a FakeValidator that always passes.
func MakeSadMapValidator ¶
func MakeSadMapValidator(t *testing.T) *FakeValidator
MakeSadMapValidator makes a FakeValidator that always fails.
func (*FakeValidator) ErrIfInvalidKey ¶
func (v *FakeValidator) ErrIfInvalidKey(k string) error
ErrIfInvalidKey returns nil
func (*FakeValidator) IsEnvVarName ¶
func (v *FakeValidator) IsEnvVarName(k string) error
IsEnvVarName returns nil
func (*FakeValidator) MakeAnnotationNameValidator ¶
func (v *FakeValidator) MakeAnnotationNameValidator() func([]string) error
MakeAnnotationNameValidator returns a nil function
func (*FakeValidator) MakeAnnotationValidator ¶
func (v *FakeValidator) MakeAnnotationValidator() func(map[string]string) error
MakeAnnotationValidator returns a nil function
func (*FakeValidator) MakeLabelNameValidator ¶
func (v *FakeValidator) MakeLabelNameValidator() func([]string) error
MakeLabelNameValidator returns a nil function
func (*FakeValidator) MakeLabelValidator ¶
func (v *FakeValidator) MakeLabelValidator() func(map[string]string) error
MakeLabelValidator returns a nil function
func (*FakeValidator) ValidateNamespace ¶
func (v *FakeValidator) ValidateNamespace(s string) []string
ValidateNamespace validates namespace by regexp
func (*FakeValidator) Validator ¶
func (v *FakeValidator) Validator(_ map[string]string) error
Validator replaces apimachinery validation in tests. Can be set to fail or succeed to test error handling. Can confirm if run or not run by surrounding code.
func (*FakeValidator) ValidatorArray ¶
func (v *FakeValidator) ValidatorArray(_ []string) error
func (*FakeValidator) VerifyCall ¶
func (v *FakeValidator) VerifyCall()
VerifyCall returns true if Validator was used.
func (*FakeValidator) VerifyNoCall ¶
func (v *FakeValidator) VerifyNoCall()
VerifyNoCall returns true if Validator was not used.