Documentation ¶
Overview ¶
Package conformance implements tests which verify conformance of the implementation with the spec.
Index ¶
- Constants
- type FailingController
- type IntDoublerController
- type IntResource
- type IntToStrController
- type IntegerResource
- type MetricsController
- type ModifyWithResultController
- type QFailingController
- func (ctrl *QFailingController) MapInput(context.Context, *zap.Logger, controller.QRuntime, resource.Pointer) ([]resource.Pointer, error)
- func (ctrl *QFailingController) Name() string
- func (ctrl *QFailingController) Reconcile(ctx context.Context, _ *zap.Logger, r controller.QRuntime, ...) error
- func (ctrl *QFailingController) Settings() controller.QSettings
- type QIntToStrController
- func (ctrl *QIntToStrController) MapInput(_ context.Context, _ *zap.Logger, _ controller.QRuntime, ptr resource.Pointer) ([]resource.Pointer, error)
- func (ctrl *QIntToStrController) Name() string
- func (ctrl *QIntToStrController) Reconcile(ctx context.Context, _ *zap.Logger, r controller.QRuntime, ...) error
- func (ctrl *QIntToStrController) Settings() controller.QSettings
- type QIntToStrSleepingController
- func (ctrl *QIntToStrSleepingController) MapInput(_ context.Context, _ *zap.Logger, _ controller.QRuntime, ptr resource.Pointer) ([]resource.Pointer, error)
- func (ctrl *QIntToStrSleepingController) Name() string
- func (ctrl *QIntToStrSleepingController) Reconcile(ctx context.Context, logger *zap.Logger, r controller.QRuntime, ...) error
- func (ctrl *QIntToStrSleepingController) Settings() controller.QSettings
- type Resource
- func (r *Resource[T, S, SS]) DeepCopy() resource.Resource
- func (r *Resource[T, S, SS]) Metadata() *resource.Metadata
- func (r *Resource[T, S, SS]) SetValue(v T)
- func (r *Resource[T, S, SS]) Spec() any
- func (r *Resource[T, S, SS]) UnmarshalProto(md *resource.Metadata, protoSpec []byte) error
- func (r *Resource[T, S, SS]) Value() T
- type RuntimeSuite
- func (suite *RuntimeSuite) SetupTest()
- func (suite *RuntimeSuite) TearDownTest()
- func (suite *RuntimeSuite) TestCascadingSumControllers()
- func (suite *RuntimeSuite) TestControllerRuntimeMetrics()
- func (suite *RuntimeSuite) TestFailingController()
- func (suite *RuntimeSuite) TestIntDoublerController()
- func (suite *RuntimeSuite) TestIntToStrControllers()
- func (suite *RuntimeSuite) TestIntToStrToSentenceControllers()
- func (suite *RuntimeSuite) TestModifyWithResultController()
- func (suite *RuntimeSuite) TestNoControllers()
- func (suite *RuntimeSuite) TestPanickingController()
- func (suite *RuntimeSuite) TestQFailingController()
- func (suite *RuntimeSuite) TestQIntToStrController()
- func (suite *RuntimeSuite) TestQIntToStrSleepingController()
- func (suite *RuntimeSuite) TestSumControllers()
- func (suite *RuntimeSuite) TestSumControllersFiltered()
- type SentenceResource
- type Spec
- type SpecPtr
- type StrResource
- type StrToSentenceController
- type StringResource
- type SumController
- type ValueGetSet
Constants ¶
const IntResourceType = resource.Type("test/int")
IntResourceType is the type of IntResource.
const SentenceResourceType = resource.Type("test/sentence")
SentenceResourceType is the type of SentenceResource.
const StrResourceType = resource.Type("test/str")
StrResourceType is the type of StrResource.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FailingController ¶
type FailingController struct { TargetNamespace resource.Namespace Panic bool // contains filtered or unexported fields }
FailingController fails on each iteration creating new resources each time.
func (*FailingController) Inputs ¶
func (ctrl *FailingController) Inputs() []controller.Input
Inputs implements controller.Controller interface.
func (*FailingController) Name ¶
func (ctrl *FailingController) Name() string
Name implements controller.Controller interface.
func (*FailingController) Outputs ¶
func (ctrl *FailingController) Outputs() []controller.Output
Outputs implements controller.Controller interface.
func (*FailingController) Run ¶
func (ctrl *FailingController) Run(ctx context.Context, r controller.Runtime, _ *zap.Logger) error
Run implements controller.Controller interface.
type IntDoublerController ¶ added in v0.3.1
type IntDoublerController struct { SourceNamespace resource.Namespace TargetNamespace resource.Namespace }
IntDoublerController doubles IntResource.
func (*IntDoublerController) Inputs ¶ added in v0.3.1
func (ctrl *IntDoublerController) Inputs() []controller.Input
Inputs implements controller.Controller interface.
func (*IntDoublerController) Name ¶ added in v0.3.1
func (ctrl *IntDoublerController) Name() string
Name implements controller.Controller interface.
func (*IntDoublerController) Outputs ¶ added in v0.3.1
func (ctrl *IntDoublerController) Outputs() []controller.Output
Outputs implements controller.Controller interface.
func (*IntDoublerController) Run ¶ added in v0.3.1
func (ctrl *IntDoublerController) Run(ctx context.Context, r controller.Runtime, _ *zap.Logger) error
Run implements controller.Controller interface.
type IntResource ¶
IntResource represents some integer value.
func NewIntResource ¶
NewIntResource creates new IntResource.
type IntToStrController ¶
type IntToStrController struct { SourceNamespace resource.Namespace TargetNamespace resource.Namespace }
IntToStrController converts IntResource to StrResource.
func (*IntToStrController) Inputs ¶
func (ctrl *IntToStrController) Inputs() []controller.Input
Inputs implements controller.Controller interface.
func (*IntToStrController) Name ¶
func (ctrl *IntToStrController) Name() string
Name implements controller.Controller interface.
func (*IntToStrController) Outputs ¶
func (ctrl *IntToStrController) Outputs() []controller.Output
Outputs implements controller.Controller interface.
func (*IntToStrController) Run ¶
func (ctrl *IntToStrController) Run(ctx context.Context, r controller.Runtime, _ *zap.Logger) error
Run implements controller.Controller interface.
type IntegerResource ¶
IntegerResource is implemented by resources holding ints.
type MetricsController ¶ added in v0.3.15
type MetricsController struct { ControllerName string SourceNamespace resource.Namespace TargetNamespace resource.Namespace }
MetricsController is a controller which does operations to facilitate testing of controller runtime metrics.
func (*MetricsController) Inputs ¶ added in v0.3.15
func (ctrl *MetricsController) Inputs() []controller.Input
Inputs implements controller.Controller interface.
func (*MetricsController) Name ¶ added in v0.3.15
func (ctrl *MetricsController) Name() string
Name implements controller.Controller interface.
func (*MetricsController) Outputs ¶ added in v0.3.15
func (ctrl *MetricsController) Outputs() []controller.Output
Outputs implements controller.Controller interface.
func (*MetricsController) Run ¶ added in v0.3.15
func (ctrl *MetricsController) Run(ctx context.Context, r controller.Runtime, _ *zap.Logger) error
Run implements controller.Controller interface.
type ModifyWithResultController ¶ added in v0.3.14
type ModifyWithResultController struct { SourceNamespace resource.Namespace TargetNamespace resource.Namespace }
ModifyWithResultController doubles IntResource.
func (*ModifyWithResultController) Inputs ¶ added in v0.3.14
func (ctrl *ModifyWithResultController) Inputs() []controller.Input
Inputs implements controller.Controller interface.
func (*ModifyWithResultController) Name ¶ added in v0.3.14
func (ctrl *ModifyWithResultController) Name() string
Name implements controller.Controller interface.
func (*ModifyWithResultController) Outputs ¶ added in v0.3.14
func (ctrl *ModifyWithResultController) Outputs() []controller.Output
Outputs implements controller.Controller interface.
func (*ModifyWithResultController) Run ¶ added in v0.3.14
func (ctrl *ModifyWithResultController) Run(ctx context.Context, r controller.Runtime, _ *zap.Logger) error
Run implements controller.Controller interface.
type QFailingController ¶ added in v0.4.0
type QFailingController struct { SourceNamespace resource.Namespace TargetNamespace resource.Namespace }
QFailingController fails in different ways.
If not failing, it copies source to destination.
func (*QFailingController) MapInput ¶ added in v0.4.0
func (ctrl *QFailingController) MapInput(context.Context, *zap.Logger, controller.QRuntime, resource.Pointer) ([]resource.Pointer, error)
MapInput implements controller.QController interface.
func (*QFailingController) Name ¶ added in v0.4.0
func (ctrl *QFailingController) Name() string
Name implements controller.QController interface.
func (*QFailingController) Reconcile ¶ added in v0.4.0
func (ctrl *QFailingController) Reconcile(ctx context.Context, _ *zap.Logger, r controller.QRuntime, ptr resource.Pointer) error
Reconcile implements controller.QController interface.
func (*QFailingController) Settings ¶ added in v0.4.0
func (ctrl *QFailingController) Settings() controller.QSettings
Settings implements controller.QController interface.
type QIntToStrController ¶ added in v0.4.0
type QIntToStrController struct { SourceNamespace resource.Namespace TargetNamespace resource.Namespace ShutdownCalled bool }
QIntToStrController converts IntResource to StrResource as a QController.
func (*QIntToStrController) MapInput ¶ added in v0.4.0
func (ctrl *QIntToStrController) MapInput(_ context.Context, _ *zap.Logger, _ controller.QRuntime, ptr resource.Pointer) ([]resource.Pointer, error)
MapInput implements controller.QController interface.
func (*QIntToStrController) Name ¶ added in v0.4.0
func (ctrl *QIntToStrController) Name() string
Name implements controller.QController interface.
func (*QIntToStrController) Reconcile ¶ added in v0.4.0
func (ctrl *QIntToStrController) Reconcile(ctx context.Context, _ *zap.Logger, r controller.QRuntime, ptr resource.Pointer) error
Reconcile implements controller.QController interface.
func (*QIntToStrController) Settings ¶ added in v0.4.0
func (ctrl *QIntToStrController) Settings() controller.QSettings
Settings implements controller.QController interface.
type QIntToStrSleepingController ¶ added in v0.4.0
type QIntToStrSleepingController struct { SourceNamespace resource.Namespace TargetNamespace resource.Namespace }
QIntToStrSleepingController converts IntResource to StrResource as a QController sleeping source seconds.
func (*QIntToStrSleepingController) MapInput ¶ added in v0.4.0
func (ctrl *QIntToStrSleepingController) MapInput(_ context.Context, _ *zap.Logger, _ controller.QRuntime, ptr resource.Pointer) ([]resource.Pointer, error)
MapInput implements controller.QController interface.
func (*QIntToStrSleepingController) Name ¶ added in v0.4.0
func (ctrl *QIntToStrSleepingController) Name() string
Name implements controller.QController interface.
func (*QIntToStrSleepingController) Reconcile ¶ added in v0.4.0
func (ctrl *QIntToStrSleepingController) Reconcile(ctx context.Context, logger *zap.Logger, r controller.QRuntime, ptr resource.Pointer) error
Reconcile implements controller.QController interface.
func (*QIntToStrSleepingController) Settings ¶ added in v0.4.0
func (ctrl *QIntToStrSleepingController) Settings() controller.QSettings
Settings implements controller.QController interface.
type Resource ¶
type Resource[T any, S Spec[T], SS SpecPtr[T, S]] struct { // contains filtered or unexported fields }
Resource represents some T value.
func NewResource ¶
func NewResource[T any, S Spec[T], SS SpecPtr[T, S]](md resource.Metadata, value T) *Resource[T, S, SS]
NewResource creates new Resource.
func (*Resource[T, S, SS]) SetValue ¶
func (r *Resource[T, S, SS]) SetValue(v T)
SetValue set spec with provided value.
func (*Resource[T, S, SS]) UnmarshalProto ¶
UnmarshalProto implements protobuf.ResourceUnmarshaler.
type RuntimeSuite ¶
type RuntimeSuite struct { suite.Suite State state.State Runtime controller.Engine SetupRuntime func() TearDownRuntime func() MetricsReadCacheEnabled bool // contains filtered or unexported fields }
RuntimeSuite ...
func (*RuntimeSuite) TestCascadingSumControllers ¶
func (suite *RuntimeSuite) TestCascadingSumControllers()
TestCascadingSumControllers ...
func (*RuntimeSuite) TestControllerRuntimeMetrics ¶ added in v0.3.15
func (suite *RuntimeSuite) TestControllerRuntimeMetrics()
TestControllerRuntimeMetrics ...
func (*RuntimeSuite) TestFailingController ¶
func (suite *RuntimeSuite) TestFailingController()
TestFailingController ...
func (*RuntimeSuite) TestIntDoublerController ¶ added in v0.3.1
func (suite *RuntimeSuite) TestIntDoublerController()
TestIntDoublerController ...
func (*RuntimeSuite) TestIntToStrControllers ¶
func (suite *RuntimeSuite) TestIntToStrControllers()
TestIntToStrControllers ...
func (*RuntimeSuite) TestIntToStrToSentenceControllers ¶
func (suite *RuntimeSuite) TestIntToStrToSentenceControllers()
TestIntToStrToSentenceControllers ...
func (*RuntimeSuite) TestModifyWithResultController ¶ added in v0.3.14
func (suite *RuntimeSuite) TestModifyWithResultController()
TestModifyWithResultController ...
func (*RuntimeSuite) TestNoControllers ¶
func (suite *RuntimeSuite) TestNoControllers()
TestNoControllers ...
func (*RuntimeSuite) TestPanickingController ¶ added in v0.2.1
func (suite *RuntimeSuite) TestPanickingController()
TestPanickingController ...
func (*RuntimeSuite) TestQFailingController ¶ added in v0.4.0
func (suite *RuntimeSuite) TestQFailingController()
TestQFailingController ...
func (*RuntimeSuite) TestQIntToStrController ¶ added in v0.4.0
func (suite *RuntimeSuite) TestQIntToStrController()
TestQIntToStrController ...
func (*RuntimeSuite) TestQIntToStrSleepingController ¶ added in v0.4.0
func (suite *RuntimeSuite) TestQIntToStrSleepingController()
TestQIntToStrSleepingController ...
func (*RuntimeSuite) TestSumControllers ¶
func (suite *RuntimeSuite) TestSumControllers()
TestSumControllers ...
func (*RuntimeSuite) TestSumControllersFiltered ¶
func (suite *RuntimeSuite) TestSumControllersFiltered()
TestSumControllersFiltered ...
type SentenceResource ¶
SentenceResource represents some string value.
func NewSentenceResource ¶
NewSentenceResource creates new SentenceResource.
type Spec ¶
type Spec[T any] interface { Value() T }
Spec requires spec to have a set of Get methods.
type StrResource ¶
StrResource represents some string value.
func NewStrResource ¶
NewStrResource creates new StrResource.
type StrToSentenceController ¶
type StrToSentenceController struct { SourceNamespace resource.Namespace TargetNamespace resource.Namespace }
StrToSentenceController converts StrResource to SentenceResource.
func (*StrToSentenceController) Inputs ¶
func (ctrl *StrToSentenceController) Inputs() []controller.Input
Inputs implements controller.Controller interface.
func (*StrToSentenceController) Name ¶
func (ctrl *StrToSentenceController) Name() string
Name implements controller.Controller interface.
func (*StrToSentenceController) Outputs ¶
func (ctrl *StrToSentenceController) Outputs() []controller.Output
Outputs implements controller.Controller interface.
func (*StrToSentenceController) Run ¶
func (ctrl *StrToSentenceController) Run(ctx context.Context, r controller.Runtime, _ *zap.Logger) error
Run implements controller.Controller interface.
type StringResource ¶
StringResource is implemented by resources holding strings.
type SumController ¶
type SumController struct { SourceNamespace resource.Namespace TargetNamespace resource.Namespace TargetID resource.ID ControllerName string SourceLabelQuery resource.LabelQuery }
SumController calculates sum of IntResources into new IntResource.
func (*SumController) Inputs ¶
func (ctrl *SumController) Inputs() []controller.Input
Inputs implements controller.Controller interface.
func (*SumController) Name ¶
func (ctrl *SumController) Name() string
Name implements controller.Controller interface.
func (*SumController) Outputs ¶
func (ctrl *SumController) Outputs() []controller.Output
Outputs implements controller.Controller interface.
func (*SumController) Run ¶
func (ctrl *SumController) Run(ctx context.Context, r controller.Runtime, _ *zap.Logger) error
Run implements controller.Controller interface.
type ValueGetSet ¶
type ValueGetSet[T any] struct { // contains filtered or unexported fields }
ValueGetSet is a basic building block for IntegerResource and StringResource implementations.
func (*ValueGetSet[T]) SetValue ¶
func (s *ValueGetSet[T]) SetValue(t T)
func (ValueGetSet[T]) Value ¶
func (s ValueGetSet[T]) Value() T