Documentation ¶
Index ¶
- Variables
- func AssertDiff(t *testing.T, expected interface{}, actual interface{})
- func InitScheme(t *testing.T) *runtime.Scheme
- func ReadOrUpdateGoldenFile(t *testing.T, content string, update bool) string
- func RequireClusterToBeReadyEventually(t *testing.T, sb testenv.DiffingSandbox, b ClusterBuilder)
- func RequireClusterToBeReadyEventuallyTimeout(t *testing.T, sb testenv.DiffingSandbox, b ClusterBuilder, ...)
- func RequireDatabaseToFunction(t *testing.T, sb testenv.DiffingSandbox, b ClusterBuilder)
- func RequireDbContainersToUseImage(t *testing.T, sb testenv.DiffingSandbox, cr *api.CrdbCluster)
- func RequireDecommissionNode(t *testing.T, sb testenv.DiffingSandbox, b ClusterBuilder, numNodes int32)
- func RequireDownGradeOptionSet(t *testing.T, sb testenv.DiffingSandbox, b ClusterBuilder, version string)
- func RequirePVCToResize(t *testing.T, sb testenv.DiffingSandbox, b ClusterBuilder, ...)
- func Yamlizers(t *testing.T, scheme *runtime.Scheme) (func([]byte) runtime.Object, func(runtime.Object, io.Writer) error)
- type Action
- type ClusterBuilder
- func (b ClusterBuilder) Cluster() *resource.Cluster
- func (b ClusterBuilder) Cr() *api.CrdbCluster
- func (b ClusterBuilder) Namespaced(namespace string) ClusterBuilder
- func (b ClusterBuilder) WithCockroachDBVersion(version string) ClusterBuilder
- func (b ClusterBuilder) WithHTTPPort(port int32) ClusterBuilder
- func (b ClusterBuilder) WithImage(image string) ClusterBuilder
- func (b ClusterBuilder) WithMaxUnavailable(max *int32) ClusterBuilder
- func (b ClusterBuilder) WithNodeCount(c int32) ClusterBuilder
- func (b ClusterBuilder) WithNodeTLS(secret string) ClusterBuilder
- func (b ClusterBuilder) WithPVDataStore(size, storageClass string) ClusterBuilder
- func (b ClusterBuilder) WithTLS() ClusterBuilder
- func (b ClusterBuilder) WithUID(uid string) ClusterBuilder
- type CreateAction
- type FakeClient
- func (c *FakeClient) AddReactor(verb string, resource string, reaction ReactionFunc)
- func (c *FakeClient) Create(ctx context.Context, obj client.Object, opts ...client.CreateOption) error
- func (c *FakeClient) Delete(_ context.Context, obj client.Object, opts ...client.DeleteOption) error
- func (c *FakeClient) DeleteAllOf(_ context.Context, obj client.Object, opts ...client.DeleteAllOfOption) error
- func (c *FakeClient) Get(ctx context.Context, key client.ObjectKey, obj client.Object) error
- func (c *FakeClient) List(_ context.Context, list client.ObjectList, opts ...client.ListOption) error
- func (c *FakeClient) Patch(_ context.Context, obj client.Object, patch client.Patch, ...) error
- func (c *FakeClient) RESTMapper() meta.RESTMapper
- func (c *FakeClient) Scheme() *runtime.Scheme
- func (c *FakeClient) Status() client.StatusWriter
- func (c *FakeClient) Update(ctx context.Context, obj client.Object, opts ...client.UpdateOption) error
- type GetAction
- type ReactionFunc
- type Reactor
- type Step
- type Steps
- type ValidateHeaders
Constants ¶
This section is empty.
Variables ¶
var DateRegex = "20\\d\\d"
var DefaultRetry = wait.Backoff{ Duration: 10 * time.Microsecond, Factor: 1.0, Jitter: 0.1, Steps: 500, }
var RuntimeObjCmpOpts = []cmp.Option{ cmpopts.IgnoreTypes(metav1.TypeMeta{}), cmpopts.IgnoreFields(metav1.ObjectMeta{}, "ResourceVersion", "SelfLink", "Generation", "CreationTimestamp"), }
Functions ¶
func AssertDiff ¶
AssertDiff compares an expected interface with an actual interface and fails if the two interfaces do not match. This func removes all metadata calico annotations.
func ReadOrUpdateGoldenFile ¶
func RequireClusterToBeReadyEventually ¶ added in v1.7.13
func RequireClusterToBeReadyEventually(t *testing.T, sb testenv.DiffingSandbox, b ClusterBuilder)
func RequireClusterToBeReadyEventuallyTimeout ¶ added in v1.7.13
func RequireClusterToBeReadyEventuallyTimeout(t *testing.T, sb testenv.DiffingSandbox, b ClusterBuilder, timeout time.Duration)
RequireClusterToBeReadyEventuallyTimeout tests to see if a statefulset has started correctly and all of the pods are running.
func RequireDatabaseToFunction ¶ added in v1.7.13
func RequireDatabaseToFunction(t *testing.T, sb testenv.DiffingSandbox, b ClusterBuilder)
RequireDatabaseToFunction tests that the database is functioning correctly
func RequireDbContainersToUseImage ¶ added in v1.7.13
func RequireDbContainersToUseImage(t *testing.T, sb testenv.DiffingSandbox, cr *api.CrdbCluster)
RequireDbContainersToUseImage checks that the database is using the correct image
func RequireDecommissionNode ¶ added in v1.7.13
func RequireDecommissionNode(t *testing.T, sb testenv.DiffingSandbox, b ClusterBuilder, numNodes int32)
RequireDecommisionNode requires that proper nodes are decommisioned
func RequireDownGradeOptionSet ¶ added in v1.7.13
func RequireDownGradeOptionSet(t *testing.T, sb testenv.DiffingSandbox, b ClusterBuilder, version string)
func RequirePVCToResize ¶ added in v1.7.13
func RequirePVCToResize(t *testing.T, sb testenv.DiffingSandbox, b ClusterBuilder, quantity apiresource.Quantity)
RequirePVCToResize checks that the PVCs are resized correctly
Types ¶
type Action ¶
type Action interface { Verb() string GVR() schema.GroupVersionResource Key() client.ObjectKey }
func NewCreateAction ¶
func NewCreateAction(key client.ObjectKey, gvr schema.GroupVersionResource) Action
func NewGetAction ¶
func NewGetAction(key client.ObjectKey, gvr schema.GroupVersionResource) Action
type ClusterBuilder ¶
type ClusterBuilder struct {
// contains filtered or unexported fields
}
func NewBuilder ¶
func NewBuilder(name string) ClusterBuilder
func (ClusterBuilder) Cluster ¶
func (b ClusterBuilder) Cluster() *resource.Cluster
func (ClusterBuilder) Cr ¶
func (b ClusterBuilder) Cr() *api.CrdbCluster
func (ClusterBuilder) Namespaced ¶
func (b ClusterBuilder) Namespaced(namespace string) ClusterBuilder
func (ClusterBuilder) WithCockroachDBVersion ¶ added in v1.7.13
func (b ClusterBuilder) WithCockroachDBVersion(version string) ClusterBuilder
func (ClusterBuilder) WithHTTPPort ¶
func (b ClusterBuilder) WithHTTPPort(port int32) ClusterBuilder
func (ClusterBuilder) WithImage ¶
func (b ClusterBuilder) WithImage(image string) ClusterBuilder
func (ClusterBuilder) WithMaxUnavailable ¶
func (b ClusterBuilder) WithMaxUnavailable(max *int32) ClusterBuilder
func (ClusterBuilder) WithNodeCount ¶
func (b ClusterBuilder) WithNodeCount(c int32) ClusterBuilder
func (ClusterBuilder) WithNodeTLS ¶
func (b ClusterBuilder) WithNodeTLS(secret string) ClusterBuilder
func (ClusterBuilder) WithPVDataStore ¶
func (b ClusterBuilder) WithPVDataStore(size, storageClass string) ClusterBuilder
func (ClusterBuilder) WithTLS ¶
func (b ClusterBuilder) WithTLS() ClusterBuilder
func (ClusterBuilder) WithUID ¶
func (b ClusterBuilder) WithUID(uid string) ClusterBuilder
type CreateAction ¶
type CreateAction struct {
// contains filtered or unexported fields
}
func (CreateAction) GVR ¶
func (a CreateAction) GVR() schema.GroupVersionResource
func (CreateAction) Key ¶
func (a CreateAction) Key() client.ObjectKey
func (CreateAction) Verb ¶
func (a CreateAction) Verb() string
type FakeClient ¶
type FakeClient struct { // ReactionChain is the list of reactors that will be attempted for every // request in the order they are tried. ReactionChain []Reactor // contains filtered or unexported fields }
FakeClient is inspired and taken from https://github.com/kubernetes/client-go/
func NewFakeClient ¶
func NewFakeClient(scheme *runtime.Scheme, objs ...runtime.Object) *FakeClient
func (*FakeClient) AddReactor ¶
func (c *FakeClient) AddReactor(verb string, resource string, reaction ReactionFunc)
func (*FakeClient) Create ¶
func (c *FakeClient) Create(ctx context.Context, obj client.Object, opts ...client.CreateOption) error
func (*FakeClient) Delete ¶
func (c *FakeClient) Delete(_ context.Context, obj client.Object, opts ...client.DeleteOption) error
func (*FakeClient) DeleteAllOf ¶
func (c *FakeClient) DeleteAllOf(_ context.Context, obj client.Object, opts ...client.DeleteAllOfOption) error
func (*FakeClient) List ¶
func (c *FakeClient) List(_ context.Context, list client.ObjectList, opts ...client.ListOption) error
func (*FakeClient) Patch ¶
func (c *FakeClient) Patch(_ context.Context, obj client.Object, patch client.Patch, opts ...client.PatchOption) error
func (*FakeClient) RESTMapper ¶
func (c *FakeClient) RESTMapper() meta.RESTMapper
func (*FakeClient) Scheme ¶
func (c *FakeClient) Scheme() *runtime.Scheme
func (*FakeClient) Status ¶
func (c *FakeClient) Status() client.StatusWriter
func (*FakeClient) Update ¶
func (c *FakeClient) Update(ctx context.Context, obj client.Object, opts ...client.UpdateOption) error
type GetAction ¶
type GetAction struct {
// contains filtered or unexported fields
}
func (GetAction) GVR ¶
func (a GetAction) GVR() schema.GroupVersionResource
type ReactionFunc ¶
ReactionFunc is a function returning `handled` set to true if no further processing is required and an error if one needs to be raised
type Reactor ¶
type Reactor interface { // Handles indicates whether or not this Reactor deals with a given // action. Handles(action Action) bool // React handles the action and returns results. It may choose to // delegate by indicated handled=false. React(action Action) (handled bool, err error) }
Reactor is an interface to allow the composition of reaction functions.
type Steps ¶ added in v1.7.13
type Steps []Step
Steps
type ValidateHeaders ¶
type ValidateHeaders struct {
// contains filtered or unexported fields
}
ValidateHeaders represents a project that that needs to be scanned.
func NewValidateHeaders ¶
func NewValidateHeaders(fileNames *[]string, rootDir string, boilerplateDir string, forceExtension string) ValidateHeaders
NewValidateHeaders creates a new struct used to validate a project.
func (ValidateHeaders) Validate ¶
func (v ValidateHeaders) Validate() (nonconformingFilesPtr *[]string, err error)
Validate iterates over a set of files and returns a slice of files that do not have the proper headers. A slice of files are returned that containes the filenames of files that do not have a header that matches the boilerplate.