Documentation ¶
Overview ¶
Package v1 contains the v1 version of the testkit package. This is meant to aid developers in testing out minder rule types and other components.
Index ¶
- Variables
- type Option
- type TestKit
- func (_ *TestKit) CanImplement(_ minderv1.ProviderType) bool
- func (_ *TestKit) Clone(_ context.Context, _ string, _ string) (*git.Repository, error)
- func (_ *TestKit) DeregisterEntity(_ context.Context, _ minderv1.Entity, _ *properties.Properties) error
- func (tk *TestKit) Do(ctx context.Context, req *http.Request) (*http.Response, error)
- func (_ *TestKit) FetchAllProperties(_ context.Context, _ *properties.Properties, _ minderv1.Entity, ...) (*properties.Properties, error)
- func (_ *TestKit) FetchProperty(_ context.Context, _ *properties.Properties, _ minderv1.Entity, _ string) (*properties.Property, error)
- func (_ *TestKit) GetBaseURL() string
- func (_ *TestKit) GetConfig() protoreflect.ProtoMessage
- func (_ *TestKit) GetEntityName(_ minderv1.Entity, _ *properties.Properties) (string, error)
- func (_ *TestKit) GetType() string
- func (tk *TestKit) Ingest(ctx context.Context, ent protoreflect.ProtoMessage, params map[string]any) (*interfaces.Result, error)
- func (_ *TestKit) NewRequest(method, url string, body any) (*http.Request, error)
- func (_ *TestKit) PropertiesToProtoMessage(_ minderv1.Entity, _ *properties.Properties) (protoreflect.ProtoMessage, error)
- func (_ *TestKit) RegisterEntity(_ context.Context, _ minderv1.Entity, _ *properties.Properties) (*properties.Properties, error)
- func (_ *TestKit) ReregisterEntity(_ context.Context, _ minderv1.Entity, _ *properties.Properties) error
- func (tk *TestKit) ShouldOverrideIngest() bool
- func (_ *TestKit) SupportsEntity(_ minderv1.Entity) bool
- type VoidResultSink
Constants ¶
This section is empty.
Variables ¶
var ( // ErrIngestUnimplemented is returned when the ingester is not implemented ErrIngestUnimplemented = errors.New("ingester not implemented") )
var ( // ErrNotIngeserOverridden is returned when a provider trait is not overridden. ErrNotIngeserOverridden = errors.New("ingester not overridden") )
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*TestKit)
Option is a functional option type for TestKit
func WithGitDir ¶
WithGitDir is a functional option to set the git directory Note that if the `git` ingest type is used, you need to overwrite the ingester in the rule type engine.
type TestKit ¶
type TestKit struct {
// contains filtered or unexported fields
}
TestKit implements a set of interfaces for testing purposes. e.g. for testing rule types.
func (*TestKit) CanImplement ¶
func (_ *TestKit) CanImplement(_ minderv1.ProviderType) bool
CanImplement implements the Provider interface. It returns true since we don't have any restrictions on the provider.
func (*TestKit) Clone ¶
Clone Implements the Git trait. This is a stub implementation that allows us to instantiate a Git ingester. This will later be overridden by the actual implementation.
func (*TestKit) DeregisterEntity ¶
func (_ *TestKit) DeregisterEntity(_ context.Context, _ minderv1.Entity, _ *properties.Properties) error
DeregisterEntity implements the Provider interface.
func (*TestKit) FetchAllProperties ¶
func (_ *TestKit) FetchAllProperties( _ context.Context, _ *properties.Properties, _ minderv1.Entity, _ *properties.Properties, ) (*properties.Properties, error)
FetchAllProperties implements the Provider interface.
func (*TestKit) FetchProperty ¶
func (_ *TestKit) FetchProperty( _ context.Context, _ *properties.Properties, _ minderv1.Entity, _ string) (*properties.Property, error)
FetchProperty implements the Provider interface.
func (*TestKit) GetBaseURL ¶
GetBaseURL implements the REST interface.
func (*TestKit) GetConfig ¶
func (_ *TestKit) GetConfig() protoreflect.ProtoMessage
GetConfig returns the config for the ingester
func (*TestKit) GetEntityName ¶
func (_ *TestKit) GetEntityName(_ minderv1.Entity, _ *properties.Properties) (string, error)
GetEntityName implements the Provider interface.
func (*TestKit) Ingest ¶
func (tk *TestKit) Ingest( ctx context.Context, ent protoreflect.ProtoMessage, params map[string]any, ) (*interfaces.Result, error)
Ingest is a stub implementation of the ingester
func (*TestKit) NewRequest ¶
NewRequest implements the REST interface.
func (*TestKit) PropertiesToProtoMessage ¶
func (_ *TestKit) PropertiesToProtoMessage(_ minderv1.Entity, _ *properties.Properties) (protoreflect.ProtoMessage, error)
PropertiesToProtoMessage implements the Provider interface.
func (*TestKit) RegisterEntity ¶
func (_ *TestKit) RegisterEntity(_ context.Context, _ minderv1.Entity, _ *properties.Properties) (*properties.Properties, error)
RegisterEntity implements the Provider interface.
func (*TestKit) ReregisterEntity ¶
func (_ *TestKit) ReregisterEntity(_ context.Context, _ minderv1.Entity, _ *properties.Properties) error
ReregisterEntity implements the Provider interface.
func (*TestKit) ShouldOverrideIngest ¶
ShouldOverrideIngest returns true if the ingester should override the ingest
type VoidResultSink ¶
type VoidResultSink struct{}
VoidResultSink is a result sink that does nothing
func NewVoidResultSink ¶
func NewVoidResultSink() *VoidResultSink
NewVoidResultSink creates a new void result sink
func (VoidResultSink) SetIngestResult ¶
func (VoidResultSink) SetIngestResult(_ *interfaces.Result)
SetIngestResult implements the ResultSink interface